且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Azure搜索-与第一个或单个结果完全匹配

更新时间:2023-02-14 08:39:25

使用

With Lucene Query syntax you can boost individual subqueries, for example: term^2 | term~1 - this translates to "find documents that match 'term' OR 'term' with edit distance 1, and score the exact matches higher relative to fuzzy matches by a factor of two.

search=blue^2|blue~1&queryType=full

由于文档得分是术语频率和文档反向频率的功能.如果模糊子查询将输入项扩展为文档语料库中非常独特的项,则可能需要增加提升因子(在我的示例中为2).通常,依靠相关性分数进行排序不是一个实际的想法.请参阅以下帖子中的我的答案以获取更多信息: Azure搜索得分

There is no guarantee that the exact match will always be first in the results set as the document score is a function of term frequency and inverse document frequency. If the fuzzy sub-query expands the input term to a term that's very unique in your document corpus you may need to bump the boosting factor (2 in my example). In general, relying on the relevance score for ordering is not a practical idea. Take a look at my answer in the following post for more information: Azure Search scoring

让我知道这是否有帮助