Azure认知搜索 - 模糊搜索 - 在建议API和搜索API之间保持一致

发布于 2025-02-12 16:49:51 字数 955 浏览 0 评论 0 原文

我已经实现了使用搜索API的建议+自动完成的清单页面,但是在列表中所建议的内容和所拥有的内容之间,我无法获得一致的结果。

因此,我在建议模式下的查询是: https:// xxx/indexes/my-index/doc/supsimname = gentralsearchSuggester& top = 3& fuzzy = true& $ amp; $ select = sys_id = sys_id,name,url&url& search = nin& api-version = 2020-06-30 此返回3结果:

  • nina
  • nina25
  • nick

及其搜索API我的查询是: https:// xxx/indexes/my-index/docs?api-version = 2020-06-06-30& count = true& queryType = full& searchMode = anemp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp;%24SKIP = 0&%24Top = 16&amp = 16& amp = 16& cearch = = = = = = = nin*〜1&%24select =命名

此返回2结果:

  • 尼娜
  • NINA25

在此页面中: httpps:/ -US/REST/API/SEECHSERVICE/建议我看到“编辑距离为每个查询字符串“我想这对应于〜1,但我不明白如何使其保持一致。

问候,

I have implemented both the suggest+autocomplete a listing page who use the search api but I cannot have consistent results between what is suggested and what I have in the listing.

So my query in suggest mode is:
https://xxx/indexes/my-index/docs/suggest?suggesterName=generalSearchSuggester&top=3&fuzzy=true&$select=sys_Id,Name,Url&search=nin&api-version=2020-06-30
This return 3 results:

  • Nina
  • Nina25
  • Nick

And with the search api my query is:
https://xxx/indexes/my-index/docs?api-version=2020-06-30&&count=true&queryType=full&searchMode=any&%24skip=0&%24top=16&search=nin*~1&%24select=Name

This return 2 results:

  • Nina
  • Nina25

In this page: https://learn.microsoft.com/en-us/rest/api/searchservice/suggestions I see "The edit distance is 1 per query string" so I guess that this correspond to ~1 but I don't understand how to make it consistent.

Regards,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最好是你 2025-02-19 16:49:51

在您的搜索示例中,您将使用模糊搜索的通配符搜索组合。使用,请从查询中删除 * *,然后直接使用Tilde字符指定编辑距离。

https://xxx/indexes/my-index/docs?api-version=2020-06-30&&count=true&queryType=full&searchMode=any&%24skip=0&%24top=16&search=nin~1&%24select=Name

这将与拼写距离为1。nin〜1

  • (匹配nina)
  • nin〜2(匹配nick)
  • nin〜3(匹配nina25)

模糊搜索匹配的术语,包括拼写错误
字。要进行模糊搜索,请在一个末尾附加tilde〜符号
带有可选参数的单个单词,值在0到2之间
指定编辑距离。例如,蓝色〜或蓝色〜1会返回
蓝色,蓝色和胶水。

自动完成vs搜索

自动完成建议的目的是为您提供有关搜索内容的模糊建议。它告诉您,您可以搜索Nina,Nina25或Nick。在搜索这些术语时,您将获得包含令牌Nina(或Nina25或Nick)的所有结果。

In your search example you are using a combination of a wildcard search with fuzzy search. To use fuzzy search as documented, remove the * from your query and specify the edit distance with the tilde character directly.

https://xxx/indexes/my-index/docs?api-version=2020-06-30&&count=true&queryType=full&searchMode=any&%24skip=0&%24top=16&search=nin~1&%24select=Name

This will match tokens with a spelling distance of 1.

  • nin~1 (matches nina)
  • nin~2 (matches nick)
  • nin~3 (matches nina25)

Fuzzy search matches on terms that are similar, including misspelled
words. To do a fuzzy search, append the tilde ~ symbol at the end of a
single word with an optional parameter, a value between 0 and 2, that
specifies the edit distance. For example, blue~ or blue~1 would return
blue, blues, and glue.

Autocomplete vs Search

The intent of the autocomplete suggester is to give you fuzzy suggestions on what to search for. It's telling you that you can search for either nina, nina25 or nick. When searching for these terms you will get all the results containing the token nina (or nina25 or nick).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文