如何创建在过滤时使用前缀的分面过滤器
How to create a facet filter that utilizes a prefix when filtering
我有一个字符串数据属性 type.I 我正在使用 algoliasearchHelper 对象搜索我的 Algolia 数据库。我想要做的是创建一个 facet 过滤器,它采用指定的前缀和 returns 所有具有指定属性内指定前缀的值的对象。
例如,目前我使用的是:
Helper.addDisjunctiveFacetRefinement("attributeName","Can");
这 return 是 "attributeName" 属性中具有 "Can" 值的所有对象,但它不 return 任何具有 "attributeName" 值的对象"attributeName" 属性中的 "Canada" 或 "Canadians",即使它们的前缀为 "Can"。
我怎样才能让它在过滤时使用指定的前缀进行过滤。
析取分面细化用于过滤器的精确匹配。这主要用于 select 从可能的过滤器列表中过滤出某个过滤器。我假设您想要的是获取所有可能过滤器的子集。
我们 searchForFacetValues
function. First this needs to be set up in your indexing settings as searchable(attributeName)
so we can generate the additional data structures to make the facets easily searchable. You can also read more 文档中关于该设置的内容可以实现这一点。
因此,一旦属性可搜索,您就可以使用辅助函数来优化过滤器列表,如下所示:
Helper.searchForFacetValues("attributeName","Can");
祝你有愉快的一天!
我有一个字符串数据属性 type.I 我正在使用 algoliasearchHelper 对象搜索我的 Algolia 数据库。我想要做的是创建一个 facet 过滤器,它采用指定的前缀和 returns 所有具有指定属性内指定前缀的值的对象。
例如,目前我使用的是:
Helper.addDisjunctiveFacetRefinement("attributeName","Can");
这 return 是 "attributeName" 属性中具有 "Can" 值的所有对象,但它不 return 任何具有 "attributeName" 值的对象"attributeName" 属性中的 "Canada" 或 "Canadians",即使它们的前缀为 "Can"。
我怎样才能让它在过滤时使用指定的前缀进行过滤。
析取分面细化用于过滤器的精确匹配。这主要用于 select 从可能的过滤器列表中过滤出某个过滤器。我假设您想要的是获取所有可能过滤器的子集。
我们 searchForFacetValues
function. First this needs to be set up in your indexing settings as searchable(attributeName)
so we can generate the additional data structures to make the facets easily searchable. You can also read more 文档中关于该设置的内容可以实现这一点。
因此,一旦属性可搜索,您就可以使用辅助函数来优化过滤器列表,如下所示:
Helper.searchForFacetValues("attributeName","Can");
祝你有愉快的一天!