结果相等时在Azure搜索中分页 [英] Paging in Azure search when results have equal scores

查看:81
本文介绍了结果相等时在Azure搜索中分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using Azure Search on my e-commerce site, and now i faced the problem with paging on my search page. When i reload the search page i can get different order of products. So when i'm using paging i can see same products on different pages, and this is critical.

我开始研究出了什么问题,并且在Microsoft文档 https://docs.microsoft.com/zh-cn/rest/api/searchservice/add-scoring-profiles-到搜索索引#默认得分是什么

I started researching what's going wrong, and i've found this info on Microsoft docs https://docs.microsoft.com/en-us/rest/api/searchservice/add-scoring-profiles-to-a-search-index#what-is-default-scoring

搜索得分值可以在整个结果集中重复.为了 例如,您可能有10个项目的得分为1.2,有20个项目的得分为 得分为1.0,以及20个得分为0.5的项目.当多次点击 具有相同的搜索分数,相同分数项的排序不相同 定义的,并且不稳定.再次运行查询,您可能会看到 项目转移位置.给定两个具有相同分数的项目, 无法保证先出现哪个人.

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.

因此,如果我正确理解它,那么我会遇到此问题,因为产品得分相同.

So if i got it correctly, i face this issue because products has same score.

该如何解决?

推荐答案

您正确理解了它!因为您获得的产品具有相同的分数,所以不能保证哪一个首先出现. 为了在此阶段避免出现这种情况,您可以在$ orderby参数中添加一个具有唯一值的字段,这样您就可以保证相同的顺序.但是,这种方法没有考虑得分.我们目前正在努力解决此问题.解决方案可用后,我们将更新此答案(此时的预计到达时间为几周,而不是几个月).

You got it correctly! Because the products you are getting have the same score, there is no guarantee which one appears first. In order to avoid it in this stage, you can add to your $orderby parameter a field that has unique values, and that way you guarantee the same order. However, this approach doesn’t take scoring into account. We are currently working on a solution to this problem. We will update this answer once the solution is available (the ETA at this point is weeks, not months).

这篇关于结果相等时在Azure搜索中分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆