Vasyl Senko
Vasyl Senko

Reputation: 1829

How to mach all documents in Azure Search

I want to get all documents from azure search and filter out with NOT operator. For example, I want to get all documents without term wifi.

NOT operator can't be used on its own, from lucene documentation:

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

For that we have to match all documents and then filter out some:

*:* NOT wifi

Question: How can I match all documents in azure search like *:* in lucene? Thanks in advance!

Upvotes: 0

Views: 188

Answers (1)

Nate Ko
Nate Ko

Reputation: 933

One way is to issue a regex search that matches all documents and filter out ones you don't want with the NOT operator. Note that regex search is only supported in the full Lucene query syntax (queryType=full).

For example.

search=/.*/ NOT "Jakarta apache"&queryType=full.

Please note that the "match all" regex pattern can potentially expensive, because it expands to all the terms in the searchable fields in the index. Please make sure it meets your expectation performance-wise.

Nate

Upvotes: 1

Related Questions