Class BooleanFilter

  • All Implemented Interfaces:
    Serializable, Iterable<FilterClause>

    public class BooleanFilter
    extends 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 Detail

      • BooleanFilter

        public BooleanFilter()
    • Method Detail

      • getDocIdSet

        public DocIdSet getDocIdSet​(IndexReader reader)
                             throws IOException
        Returns the a DocIdSetIterator representing the Boolean composition of the filters that have been added.
        Specified by:
        getDocIdSet in class Filter
        Parameters:
        reader - a IndexReader instance opened on the index currently searched on. Note, it is likely that the provided reader does not represent the whole underlying index i.e. if the index has more than one segment the given reader only represents a single segment.
        Returns:
        a DocIdSet that provides the documents which should be permitted or prohibited in search results. NOTE: null can be returned if no documents will be accepted by this Filter.
        Throws:
        IOException
        See Also:
        DocIdBitSet
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toString

        public String toString()
        Prints a user-readable version of this Filter.
        Overrides:
        toString in class Object