Package org.apache.lucene.search
Class BooleanFilter
- java.lang.Object
-
- org.apache.lucene.search.Filter
-
- org.apache.lucene.search.BooleanFilter
-
- All Implemented Interfaces:
Serializable
,Iterable<FilterClause>
public class BooleanFilter extends org.apache.lucene.search.Filter implements Iterable<FilterClause>
A container Filter that allows Boolean composition of Filters. Filters are allocated into one of three logical constructs; SHOULD, MUST NOT, MUST The results Filter BitSet is constructed as follows: SHOULD Filters are OR'd together The resulting Filter is NOT'd with the NOT Filters The resulting Filter is AND'd with the MUST Filters- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BooleanFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(FilterClause filterClause)
Adds a new FilterClause to the Boolean Filter containervoid
add(org.apache.lucene.search.Filter filter, org.apache.lucene.search.BooleanClause.Occur occur)
List<FilterClause>
clauses()
Returns the list of clausesboolean
equals(Object obj)
org.apache.lucene.search.DocIdSet
getDocIdSet(org.apache.lucene.index.IndexReader reader)
Returns the a DocIdSetIterator representing the Boolean composition of the filters that have been added.int
hashCode()
Iterator<FilterClause>
iterator()
Returns an iterator on the clauses in this query.String
toString()
Prints a user-readable version of this Filter.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
getDocIdSet
public org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.IndexReader reader) throws IOException
Returns the a DocIdSetIterator representing the Boolean composition of the filters that have been added.- Specified by:
getDocIdSet
in classorg.apache.lucene.search.Filter
- Throws:
IOException
-
add
public void add(FilterClause filterClause)
Adds a new FilterClause to the Boolean Filter container- Parameters:
filterClause
- A FilterClause object containing a Filter and an Occur parameter
-
add
public final void add(org.apache.lucene.search.Filter filter, org.apache.lucene.search.BooleanClause.Occur occur)
-
clauses
public List<FilterClause> clauses()
Returns the list of clauses
-
iterator
public final Iterator<FilterClause> iterator()
Returns an iterator on the clauses in this query. It implements theIterable
interface to make it possible to do:for (FilterClause clause : booleanFilter) {}
- Specified by:
iterator
in interfaceIterable<FilterClause>
-
-