
Lucene 4 Cookbook
By :

A BooleanQuery is a combination of other queries in which you can specify whether each subquery must, must not, or should match. These options provide the foundation to build up to logical operators of AND, OR, and NOT, which you can use in QueryParser. Here is a quick review on QueryParser syntax for BooleanQuery:
"+" means required; for example, a search string +humpty dumpty equates to must match humpty and should match "dumpty"
"-" means must not match; for example, a search string -humpty dumpty
equates to must not match humpty and should match dumpty
AND, OR, and NOT are pseudo Boolean operators. Under the hood, Lucene uses BooleanClause.Occur
to model these operators. The options for occur are MUST, MUST_NOT
, and SHOULD
. In an AND query, both terms must match. In an OR query, both terms should match. Lastly, in a NOT query, the term MUST_NOT
exists. For example, humpty AND dumpty
means must match both humpty and dumpty, humpty OR dumpty means should match either or both...
Change the font size
Change margin width
Change background colour