azure - 当结果具有相同分数时在 Azure 搜索中进行分页

我在电子商务网站上使用 Azure 搜索,现在我在搜索页面上遇到分页问题。当我重新加载搜索页面时,我可以获得不同的产品顺序。因此,当我使用分页时,我可以在不同页面上看到相同的产品,这一点至关重要。

我开始研究出了什么问题,我在 Microsoft 文档 https://learn.microsoft.com/en-us/rest/api/searchservice/add-scoring-profiles-to-a-search-index#what-is-default-scoring 上找到了此信息

Search score values can be repeated throughout a result set. For example, you might have 10 items with a score of 1.2, 20 items with a score of 1.0, and 20 items with a score of 0.5. When multiple hits have the same search score, the ordering of same scored items is not defined, and is not stable. Run the query again, and you might see items shift position. Given two items with an identical score, there is no guarantee which one appears first.

因此,如果我正确理解,我将面临这个问题,因为产品具有相同的分数。

如何解决这个问题?

最佳答案

你猜对了!由于您获得的产品具有相同的分数,因此无法保证哪个产品首先出现。 为了避免在此阶段发生这种情况,您可以向 $orderby 参数添加一个具有唯一值的字段,这样就可以保证相同的顺序。然而,这种方法没有考虑评分。我们目前正在研究这个问题的解决方案。一旦解决方案可用,我们将更新此答案(此时的预计时间是几周,而不是几个月)。

https://stackoverflow.com/questions/43592776/

相关文章:

sql - 将前导零添加到 varchar 列

scikit-learn - 具有高斯过程的多输出空间统计

azure - 将 CloudFlare CDN 与 Azure Blob 存储结合使用

java - 如果单例不好!为什么spring bean默认是单调的

r - R中的双重居中

persistence - 在 Quartz 调度程序中看到异常导致作业无法运行

r - 为列名传递变量?

java - 使用 Java 8 Streams 将 Map 的 Map 转换为 Lists

c++ - 复制具有线程安全规则建议的非const参数的构造函数?

python-3.x - 安装anaconda3后找不到conda命令