Sep 20, 2024
Create or update a batch of Recommend Rules
Create or update a batch of Recommend Rules
Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same objectID
already exists.
You may also specify true
for clearExistingRules
, in which case the batch will atomically replace all the existing Recommend Rules.
Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a source item instead of a query. The main differences are the following:
- Conditions
pattern
andanchoring
are unavailable. - Condition
filters
triggers if the source item matches the specified filters. - Condition
filters
accepts numeric filters. - Consequence
params
only covers filtering parameters. - Consequence
automaticFacetFilters
doesn’t require a facet value placeholder (it tries to match the data source item’s attributes instead).
Usage
Required ACL:
editSettings
Copy
1
2
3
4
5
6
7
8
9
10
import com.algolia.client.api.RecommendClient
import com.algolia.client.configuration.*
import com.algolia.client.transport.*
val client = RecommendClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")
var response = client.batchRecommendRules(
indexName = "ALGOLIA_INDEX_NAME",
model = RecommendModels.entries.first { it.value == "related-products" },
)
Did you find this page helpful?