如何匹配 Azure 搜索中的所有文档

How to mach all documents in Azure Search

我想从 azure search 中获取所有文档并使用 NOT 运算符过滤掉。比如我想获取所有没有term wifi的文档。

NOT 运算符不能单独使用,来自 lucene 文档:

The NOT operator cannot be used with just one term. For example, the following search will return no results: NOT "jakarta apache"

为此,我们必须匹配所有文档,然后过滤掉一些:

*:* NOT wifi

问题:如何像lucene中的*:*一样匹配azure search中的所有文档? 提前致谢!

一种方法是发出匹配所有文档的正则表达式搜索,并使用 NOT 运算符过滤掉不需要的文档。请注意,正则表达式搜索仅在完整的 Lucene 查询语法 (queryType=full) 中受支持。

例如。

search=/.*/ 不是 "Jakarta apache"&queryType=full。

请注意,"match all" 正则表达式模式的开销可能很大,因为它会扩展到索引中可搜索字段中的所有术语。请确保它在性能方面符合您的期望。

内特