Algolia:使用可能值的字符串数组按字符串数组属性过滤索引

Algolia: Filter Index by string array attribute with a string array of possible values

我有一个包含如下对象的 Algolia 索引:

 id: 2,
 name: test,
 important: ["lorem", "ipsum", "dolor", "sit", "amet"]

我想检索所有条目,例如包含 "dolor""sit"

我该怎么做?

注意:这只是一个示例,每个条目的 important 数组通常包含大约 1 到 4 个值(总共大约 1.000 个可能的值)。按 / 搜索以过滤它的数组可以包含 1 到 400 个值之间的任何值。


什么 AFAIK 不起作用:

Non-numeric attributes (e.g. strings) need to be set up as categories, which we call facets.

所以我想知道这是否可能...?或者也许我以错误的方式处理这个问题?

您找对地方了,需要组合 attributesForFaceting 和过滤器:

您的过滤器将如下所示:{ "filters": "important:dolor OR important:sit" }