【发布时间】:2021-10-22 10:26:59
【问题描述】:
在我的 azure 认知搜索索引中,当我搜索“教育”一词时,我得到了 660 次点击。当我搜索“教育”这个词时,我也得到了 660 次点击。两者似乎都返回相同的结果,其中包含单词的两种变体。
但是,我在使用通配符时看到了非常奇怪的行为:
edu* returns 660 results (expected)
educ* returns 660 results (expected)
educa* returns 2 results (matches two instances of the hyphenated word "educa-tion")
educat* returns 0 results (unexpected)
educati* returns 0 results (unexpected)
educatio* returns 0 results (unexpected)
每个搜索字段都使用英语 Lucene 语言分析器,并且 queryType 设置为“full”,searchMode 设置为“all”。
为什么最后的结果没有返回任何东西?
顺便说一句,我发现关于在单词开头使用通配符的信息相互矛盾。
lucene 文档说:
注意:您不能使用 * 或 ?符号作为 a 的第一个字符 搜索。
发件人:https://lucene.apache.org/core/2_9_4/queryparsersyntax.html
但在微软的网站上,他们似乎暗示它应该可以工作:
术语片段出现在 * 或 ? 之后,用正斜杠分隔 构造。例如,search=/.*numeric./ 返回“字母数字”。
发件人:https://docs.microsoft.com/en-us/azure/search/query-lucene-syntax#bkmk_wildcard
我试过 *ducation(返回错误)和 /.*ducation./(返回 0 个结果)。
感谢您的帮助。
【问题讨论】:
标签: lucene azure-cognitive-search