File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
templates/swift/guides/search Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,22 @@ import Core
77{ {> snippets/import} }
88
99func setSettingsThenSaveObjects() async throws {
10- do {
11- {{> snippets/init} }
10+ for playlist in playlists {
11+ // Fetch from your own data storage and with your own code
12+ // the associated application ID and API key for this user
13+ let appID = getAppIDFor(playlist.user);
14+ let apiKey = getIndexingApiKeyFor(playlist.user);
1215
13- let settings = IndexSettings(
14- attributesForFaceting: ["filterOnly(user)"]
15- )
16- { {#dynamicSnippet} }setSettings{ {/dynamicSnippet} }
16+ do {
17+ let client = try SearchClient(appID: appID, apiKey: apiKey)
18+ let settings = IndexSettings(
19+ attributesForFaceting: [" filterOnly(user)" ]
20+ )
21+ {{#dynamicSnippet} }setSettings{ {/dynamicSnippet} }
1722
18- { {#dynamicSnippet} }saveObjectsPlaylists{ {/dynamicSnippet} }
19- } catch {
20- print(error)
23+ { {#dynamicSnippet} }saveObjectsPlaylists{ {/dynamicSnippet} }
24+ } catch {
25+ print(error)
26+ }
2127 }
2228}
You can’t perform that action at this time.
0 commit comments