Difference between BooleanClause.Occur.Must and BooleanClause.Occur.SHOULD in lucene
boolean, lucene, search
Solution
`BooleanClause.Occur.SHOULD` means that the clause is optional, whereas `BooleanClause.Occur.Must` means that the clause is compulsory.
However, if a boolean query only has optional clauses, at least one clause must match for a document to appear in the results.
For better control over what documents match a BooleanQuery, there is also a minimumShouldMatch parameter which lets you tell Lucene that at least `minimumShouldMatch` `BooleanClause.Occur.SHOULD` clauses must match for a document to appear in the results.
Problem
Can anyone explain the difference between the BooleanClause.Occur.Must and BooleanClause.Occur.SHOULD in lucene in BooleanQuery with an example?