What kind of queries can not be wrapped in a boolean "not" operator?
Nested "not" operators in this context are not allowed.
A query with a positional "not" operator is of the form: "a not(b) c", and finds all documents with at least three terms where the first one is "a", the second one is not "b" and the third one is "c".
A negated sequence is of the form: "not(a b c)", and will return all documents where sequence "a b c" is not present.
A sequence with all negated terms is of the form: "not(a) not(b) not(c)".
Such sequence is ambiguous and generates an error.
Disallowing nesting of "not" operators eliminates unexpected behavior for a user.
Consider a query "not (not(word1))", which is equivalent to a query "word1".
First, a set of documents, which do not include the term "word1", is found.
The second "not" operator excludes this set of documents from the full set of the documents selecting all documents including the term "word1".
Even though the queries are essentially the same, finding the documents containing the term "word1", the result returned to the user is different. The "not" operator can be used in bolean or positional contexts in a query. The processing rules for the "not" operator differ depending on the context.
Article is closed for comments.