Azure 搜索 - 完全匹配作为第一个或单个结果
Azure Search - exact match as first or single result
我正在使用基于丰富的 Lucene 查询分析器语法的 Azure 搜索。我将“~1”定义为距离的一个符号的附加参数)。但是我遇到了问题,即即使存在完全匹配,实体也不会被排序。 (例如,"blue~1" 会 return "blues"、"blue"、"glue"。或者当搜索 "P002" 之类的产品 SKU 时,我会得到结果 "P003"、"P005"、"P004"、"P002"、"P001"、"P006")
所以我的问题是:有没有什么方法可以定义完全匹配的实体必须在列表中排在第一位,或者是单个搜索结果,即使我正在使用模糊搜索“~1”?
使用 Lucene Query syntax 您可以提升单个子查询,例如:term^2 | term~1
- 这转化为“查找匹配 'term' 或 'term' 且编辑距离为 1 的文档,并且精确匹配的得分比模糊匹配高两倍。
search=blue^2|blue~1&queryType=full
不能保证完全匹配总是在结果集中排在第一位,因为文档得分是 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:
如果有帮助请告诉我
我正在使用基于丰富的 Lucene 查询分析器语法的 Azure 搜索。我将“~1”定义为距离的一个符号的附加参数)。但是我遇到了问题,即即使存在完全匹配,实体也不会被排序。 (例如,"blue~1" 会 return "blues"、"blue"、"glue"。或者当搜索 "P002" 之类的产品 SKU 时,我会得到结果 "P003"、"P005"、"P004"、"P002"、"P001"、"P006") 所以我的问题是:有没有什么方法可以定义完全匹配的实体必须在列表中排在第一位,或者是单个搜索结果,即使我正在使用模糊搜索“~1”?
使用 Lucene Query syntax 您可以提升单个子查询,例如:term^2 | term~1
- 这转化为“查找匹配 'term' 或 'term' 且编辑距离为 1 的文档,并且精确匹配的得分比模糊匹配高两倍。
search=blue^2|blue~1&queryType=full
不能保证完全匹配总是在结果集中排在第一位,因为文档得分是 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:
如果有帮助请告诉我