Algolia Instant搜索默认顺序按州(`Live','发布)
我正在尝试以特别的顺序获取Algolia的结果,命中列有状态列,并且状态值可以是live/partered/草稿
Algolia中的数据
{ name: Post1, state: draft},
{ name: Post2, state: published},
{ name: Post3, state: live}
预期结果< /stront>
默认订单应首先进行,然后发表,然后显示草稿
{ name: Post3, state: live},
{ name: Post2, state: published},
{ name: Post1, state: draft}
I'm trying to fetch Algolia results in particular order, hits have state column, and state values can be live/published/draft
Data in algolia
{ name: Post1, state: draft},
{ name: Post2, state: published},
{ name: Post3, state: live}
Expected Result
Default order should be, first live then published and then show draft
{ name: Post3, state: live},
{ name: Post2, state: published},
{ name: Post1, state: draft}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Algolia不支持像这样的枚举类型进行排序。相反,在搜索中,将状态用作方面并允许用户根据枚举值过滤结果更为常见。
您可以通过执行“ noreflowrer”>“ noreflowrer”>多索引查询带有三个单独的查询对相同索引,每个状态值作为过滤器,然后显示每个状态的结果。
Algolia doesn't support sorting by an enumerated type like this. Instead, in search, it is more common to use the state as a facet and allow users to filter results based on the enumerated value.
You could simulate the enumerated sort by performing a multi-index query with three separate queries to the same index with each of the state values as a filter, then display the results for each state.