Azure搜索-在“包含"一词中查找匹配项 [英] Azure Search - Find matches within a word like "contains"

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

问题描述

我使用Azure搜索,而Azure搜索又使用Lucene.有什么方法可以使搜索不那么严格. 我需要的是搜索"术语"时应匹配包含"术语"的术语的文档.

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 should match "PrefixTerm", "TermSuffix", "PrefixTermSuffix"

将狐狸 part2 匹配到"part1 part2 "," part2 part3","part1 part2 part3" "

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://[服务名称] .search.windows.net/indexes/[搜索索引]/docs?api -version = 2016-09-01& queryType = 完整& search = /.* term.*//.. part2.*/

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

Azure Search支持两种查询语法,简单和完整.后者启用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天全站免登陆