Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between - and NOT operator in Lucene?

In the query syntax of Lucene it is said 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 can be used alone, which is not the case for NOT. Is that it?

like image 831
user8983999 Avatar asked Oct 01 '10 10:10

user8983999


People also ask

What are Lucene special characters?

You can't search for special characters in Lucene Search. These are + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ / @.

How do you use the wildcard in Lucene?

Lucene supports single and multiple character wildcard searches within single terms (not within phrase queries). To perform a single character wildcard search use the "?" symbol. To perform a multiple character wildcard search use the "*" symbol. You can also use the wildcard searches in the middle of a term.

Can Boolean operators like and/or and so on be used in Lucene query syntax?

You can embed Boolean operators in a query string to improve the precision of a match. The full syntax supports text operators in addition to character operators. Always specify text boolean operators (AND, OR, NOT) in all caps.

What is Lucene query syntax?

What is Lucene Query Syntax? Lucene is a query language that can be used to filter messages in your PhishER inbox. A query written in Lucene can be broken down into three parts: Field The ID or name of a specific container of information in a database.


1 Answers

There is a very subtle difference. Take a look at this long thread on "Getting a Better Understanding of Lucene's Search Operators" which should hopefully answer your question.

like image 179
dogbane Avatar answered Oct 06 '22 01:10

dogbane