0

I don't get the distinction between Occur.SHOULD and Occur.MUST in add method of org.apache.lucene.search.BooleanQuery. Can anybody explain?

kee
  • 10,969
  • 24
  • 107
  • 168
  • Have a read here http://stackoverflow.com/questions/10122733/difference-between-booleanclause-occur-must-and-booleanclause-occur-should-in-lu. This is exactly the same question and has been answered quite well. – cheffe Apr 19 '13 at 07:22

1 Answers1

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