I don't get the distinction between Occur.SHOULD and Occur.MUST in add method of org.apache.lucene.search.BooleanQuery. Can anybody explain?
Asked
Active
Viewed 2,501 times
1 Answers
4
BooleanClause.Occur.Must
stands for a Mandatory
clause. The Clause should be met for the result to be returned. Basically AND
.
BooleanClause.Occur.SHOULD
stands for the optional
clause and would behave like an OR
For Solr BooleanClause.Occur.Must
are marked with +
in the debug query explanation whereas the BooleanClause.Occur.SHOULD
have no sign associated with it.

Jayendra
- 52,349
- 4
- 80
- 90