Skip to content

Commit 387310d

Browse files
committed
feat(kotlin): setSettingsThenSaveObjects
1 parent 7402f8c commit 387310d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{> snippets/import}}
2+
import com.algolia.client.model.search.*
3+
4+
suspend fun setSettingsThenSaveObjects() {
5+
playlists.forEach { playlist ->
6+
// Fetch from your own data storage and with your own code
7+
// the associated application ID and API key for this user
8+
val appID = getAppIDFor(playlist["user"].toString());
9+
val apiKey = getIndexingApiKeyFor(playlist["user"].toString());
10+
11+
val client = SearchClient(appID, apiKey)
12+
val settings = IndexSettings(
13+
attributesForFaceting = listOf("filterOnly(user)")
14+
)
15+
16+
client.{{#dynamicSnippet}}setSettings{{/dynamicSnippet}}
17+
18+
client.{{#dynamicSnippet}}saveObjectsPlaylists{{/dynamicSnippet}}
19+
}
20+
}

0 commit comments

Comments
 (0)