事先表示歉意,因为我不是英语的人!我会尽量清楚自己要做的事情:
我正在Marketplace网站中的Angular中使用Algolia Intersearch为我的用户提供搜索小部件。我的任务是按照以下逻辑显示结果:
- 最佳结果:最佳审查产品
- 第二个结果:大多数购买的产品
- 第三结果:最近发布的产品
该“块”应该重复,因此,第四个结果将需要要成为第二大审查的产品,第五将是第二大的产品,是第二个最近发布的产品的第三,等等。这目的是允许市场上的新卖家获得曝光率,同时奖励卖出最多的人,并同时对产品进行更好的评论。
使用Algolia以某种方式可以做到这一点吗?我已经阅读了自定义排名的文档() /guides/stanaging-cresults/refine-results/sorting/indepth/interive-sort/“ rel =“ nofollow noreferrer”> https://www.algolia.com/doc/guides/guides/managing-managing-results/refine-results /sorting/indepth/详尽/),我只找到了如何设置不同的排名标准,这些标准是一个又一个又一次地使用打决犯的标准,但根本没有关于如何实现的信息这。
Apologies in advance, as I'm not a native English speaker! I'll try to be as clear as possible with what I'm trying to do:
I'm using Algolia InstantSearch in Angular in a marketplace website to provide my users with a search widget. I've been tasked with having results displayed following this logic:
- Top result: Best reviewed product
- Second result: Most purchased product
- Third result: Most recently published product
This "block" should repeat as long as there's results, so the fourth result would need to be the second best reviewed product, fifth would be the second most purchased, third the second most recently published product, and so on. This has the intention of allowing new sellers in the marketplace to get exposure, while rewarding those that have sold the most and had better reviews for their products simultaneously.
Is this possible in some way using Algolia? I've read the documentation on custom ranking (https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/) and exhaustive sorting (https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/exhaustive-sort/) and I've only found how to set different ranking criteria which are applied one after the other with tie-breakers, but no information at all about how I might achieve this.
发布评论
评论(1)
正如您在Algolia发现的那样,分类发生在索引本身内。要按不同的标准进行排序,您可以使用不同的排序标准创建索引复制品。
因此,您将拥有一个主索引 + 3副本,按评论,购买和日期排序。
您将使用多索引查询同时从所有三个副本中获取结果:
另外,别忘了按日期进行排序您需要将日期作为Unix时间戳。更多信息在这里:
https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-an-an-in-index-by-date/
As you've discovered with Algolia, sorting occurs within the index itself. To sort by different criteria you create a replica of your index with different sorting criteria.
So you'd have a primary index + 3 replicas sorted by reviews, purchases, and date.
You'll use the multi-index query to get results from all three replicas simultaneously:
https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/multi-index-search/angular/
Also, don't forget that to sort by date you'll want to out your dates as Unix timestamps. More info here:
https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-an-index-by-date/