Bool Filter

edit

See Bool Filter

FilterBuilder filter = boolFilter()
    .must(termFilter("tag", "wow"))                     
    .mustNot(rangeFilter("age").from("10").to("20"))    
    .should(termFilter("tag", "sometag"))               
    .should(termFilter("tag", "sometagtag"));           

must filter

must not filter

should filter

Note that you can cache the result using BoolFilterBuilder#cache(boolean) method. See Caching.