lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markharw00d <>
Subject BooleanFilter proposal
Date Fri, 24 Mar 2006 21:01:34 GMT
What do folks feel about a BooleanFilter which is the equivalent of 
BooleanQuery ie a filter which contains other filters, combined with the 
same "must", "should" or "must not" logic.

I know we already have ChainedFilter in the "misc" section of the 
contrib area but its methods do not echo the approach taken by 
BooleanQuery - and this means people have to think about their boolean 
logic for filters differently to queries eg
*   AND is used instead of MUST etc.
* the sequence of elements in the chain are important whereas for a 
BooleanQuery they are order-independent.

I have an implementation (thanks, Brett) which has the following API:

class BooleanFilter extends Filter
    public void addClause(FilterClause filterClause)

class FilterClause
     public FilterClause(Occur occur, Filter filter)
        this.occur = occur;
        this.filter = filter;

Some examples of how some typical filters might be mixed in a Boolean 

example "should" filters: - price range filters, date range filters
example "must not" filters:- stockDeleted=Y TermsFilter
example "must" filter:  security restrictions eg userRole:admin TermsFilter

This class allows you to mix all these filters into the one filter. The 
"must" elements eg security restrictions would override the other elements.

Do people think this is worth adding to the "contrib" section ?


Yahoo! Photos – NEW, now offering a quality print service from just 8p a photo

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message