What is the difference between NOT and Lucene in Lucene?

Lucene's query syntax says the following:

The NOT operator excludes documents that contain the term after NOT. ... The "-" or prohibit operator excludes documents that contain the term after the "-" symbol 

I think the difference is that the operator statement can be used alone, which does not apply to NOT. This is true?

+4
source share
2 answers

There is a very subtle difference. Take a look at this long thread on “A Better Understanding of Lucene Search Operators,” which I hope will answer your question.

+4
source

A long time ago, I read it somewhere ... Something similar to your assumption ... :)

The NOT operator cannot be used with just one term. For example, the following search returns no results:

NOT "jakarta apache"

whereas the operator “-” or prohibition excludes documents containing the term after the symbol “-" ...

Hope this will be helpful.

+1
source

All Articles