考虑一个填充了这样的对象的Algolia索引:
{
"objectID": 1,
"name": "My project title",
"contributor_ids": [12, 42, 34]
}
此查询是否获得具有contributor_ids 42或contributor_ids = 12的所有对象?
"numericFilters: 'contributor_ids=42, contributor_ids=12"
如果是这样,获得所有具有contributor_ids 42和contributor_ids = 12的对象的正确查询是什么?
答案 0 :(得分:9)
默认行为是AND,您可以使用带括号的OR:
numericFilters: "contributor_ids=42, contributor_ids=12"
表示contributor_ids = 42 AND contributor_ids = 12,只有在包含两个值的记录时才匹配
numericFilters: "(contributor_ids=42, contributor_ids=12)"
表示contributor_ids = 42或contributor_ids = 12
numericFilters: "contributor_ids=10,(contributor_ids=42, contributor_ids=12)"
表示contributor_ids = 10 AND(contributor_ids = 42或contributor_ids = 12)