org.apache.lucene.search

## Class BooleanFilter

- java.lang.Object
- - org.apache.lucene.search.Filter
  - - org.apache.lucene.search.BooleanFilter

- All Implemented Interfaces:
    java.io.Serializable

      public class BooleanFilter
      extends org.apache.lucene.search.Filter

  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 and Description
    `BooleanFilter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(FilterClause filterClause)` Adds a new FilterClause to the Boolean Filter container
    `boolean` | `equals(java.lang.Object obj)`
    `protected org.apache.lucene.search.DocIdSet` | `finalResult(org.apache.lucene.util.OpenBitSetDISI result, int maxDocs)` Deprecated. Either use CachingWrapperFilter, or switch to a different DocIdSet implementation yourself.
    `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()`
    `java.lang.String` | `toString()` Prints a user-readable version of this query.

    - ### Methods inherited from class org.apache.lucene.search.Filter

      `bits`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### BooleanFilter

          public BooleanFilter()

  - ### Method Detail

    - #### getDocIdSet

          public org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.IndexReader reader)
                                                        throws java.io.IOException

      Returns the a DocIdSetIterator representing the Boolean composition of the filters that have been added.
      Overrides:
        `getDocIdSet` in class `org.apache.lucene.search.Filter`
      Throws:
        `java.io.IOException`

    - #### finalResult

          protected org.apache.lucene.search.DocIdSet finalResult(org.apache.lucene.util.OpenBitSetDISI result,
                                                                  int maxDocs)

      Deprecated. Either use CachingWrapperFilter, or switch to a different DocIdSet implementation yourself.
      Provide a SortedVIntList when it is definitely smaller than an OpenBitSet.

    - #### 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

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Prints a user-readable version of this query.
      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.