Azure 搜索 - 在诸如“包含"之类的单词中查找匹配项; [英] Azure Search - Find matches within a word like "contains"

查看:35
本文介绍了Azure 搜索 - 在诸如“包含"之类的单词中查找匹配项;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Azure 搜索,而后者又使用 Lucene.有没有办法让搜索不那么严格.我需要的是在搜索term"时应该匹配包含term"的文档.

I use Azure Search which in turn uses Lucene. Is there any way to make search not that strict. What I need is when searching for "term" should match documents with terms that contain "term".

Serching fox term 应匹配PrefixTerm"、TermSuffix"、PrefixTermSuffix"

Serching fox term should match "PrefixTerm", "TermSuffix", "PrefixTermSuffix"

Serching fox part2 应匹配 "part1part2"、"part2part3"、"part1part2part3"

Serching fox part2 should match "part1part2", "part2part3", "part1part2part3"

我需要运行包含多个术语的搜索查询,例如

I need to run search query which has several terms like

"term part2"

要匹配以下文档:

{ someField:"... PrefixTermSuffix ... part1part2part3 ..." }
{ someField:"... PrefixTerm ... part2part3 ..." }
etc

推荐答案

您可以在 Azure 搜索中的 Lucene 查询语法中使用正则表达式.在您的示例中,您可以构造一个正则表达式查询,如/.term.//.part2./以查找包含两个搜索词作为子字符串的词条的文档.

You can use regex expression in Lucene query syntax in Azure Search. In your example, you can construct a regex query like /.term./ /.part2./ to find the documents with terms that contains the two search terms as substrings.

https://[service name].search.windows.net/indexes/[search index]/docs?api-version=2016-09-01&queryType=full&search=/.*term.*//.*part2.*/

https://[service name].search.windows.net/indexes/[search index]/docs?api-version=2016-09-01&queryType=full&search=/.*term.*/ /.*part2.*/

Azure 搜索支持两种查询语法,简单和完整.后者启用 Lucene 查询语法.请参阅我们的文档 (https://docs.microsoft.com/en-us/rest/api/searchservice/lucene-query-syntax-in-azure-search)以了解有关这些功能的更多信息.

Azure Search supports two query syntaxes, simple and full. The latter enables the Lucene query syntax. Please see our documentation (https://docs.microsoft.com/en-us/rest/api/searchservice/lucene-query-syntax-in-azure-search) to learn more about the capabilities.

这篇关于Azure 搜索 - 在诸如“包含"之类的单词中查找匹配项;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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