org.apache.lucene.search

## Class MultiTermQueryWrapperFilter

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

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    NumericRangeFilter, PrefixFilter, RangeFilter, TermRangeFilter

      public class MultiTermQueryWrapperFilter
      extends Filter

  A wrapper for `MultiTermQuery`, that exposes its functionality as a `Filter`.

  `MultiTermQueryWrapperFilter` is not designed to be used by itself. Normally you subclass it to provide a Filter counterpart for a `MultiTermQuery` subclass.

  For example, `TermRangeFilter` and `PrefixFilter` extend `MultiTermQueryWrapperFilter`. This class also provides the functionality behind `MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE`; this is why it is not abstract.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected MultiTermQuery` | `query`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MultiTermQueryWrapperFilter(MultiTermQuery query)` Wrap a `MultiTermQuery` as a Filter.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.BitSet` | `bits(IndexReader reader)` Deprecated. Use `getDocIdSet(IndexReader)` instead.
    `void` | `clearTotalNumberOfTerms()` Expert: Resets the counting of unique terms.
    `boolean` | `equals(java.lang.Object o)`
    `DocIdSet` | `getDocIdSet(IndexReader reader)` Returns a DocIdSet with documents that should be permitted in search results.
    `int` | `getTotalNumberOfTerms()` Expert: Return the number of unique terms visited during execution of the filter.
    `int` | `hashCode()`
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### query

          protected final MultiTermQuery query

  - ### Constructor Detail

    - #### MultiTermQueryWrapperFilter

          protected MultiTermQueryWrapperFilter(MultiTermQuery query)

      Wrap a `MultiTermQuery` as a Filter.

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

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

    - #### equals

          public final boolean equals(java.lang.Object o)

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

    - #### hashCode

          public final int hashCode()

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

    - #### getTotalNumberOfTerms

          public int getTotalNumberOfTerms()

      Expert: Return the number of unique terms visited during execution of the filter. If there are many of them, you may consider using another filter type or optimize your total term count in index.

      This method is not thread safe, be sure to only call it when no filter is running! If you re-use the same filter instance for another search, be sure to first reset the term counter with `clearTotalNumberOfTerms()`.

      See Also:
        `clearTotalNumberOfTerms()`

    - #### clearTotalNumberOfTerms

          public void clearTotalNumberOfTerms()

      Expert: Resets the counting of unique terms. Do this before executing the filter.
      See Also:
        `getTotalNumberOfTerms()`

    - #### bits

          public java.util.BitSet bits(IndexReader reader)
                                throws java.io.IOException

      Deprecated. Use `getDocIdSet(IndexReader)` instead.
      Returns a BitSet with true for documents which should be permitted in search results, and false for those that should not.
      Overrides:
        `bits` in class `Filter`
      Returns:
        A BitSet with true for documents which should be permitted in search results, and false for those that should not.

        NOTE: See `Filter.getDocIdSet(IndexReader)` for handling of multi-segment indexes (which applies to this method as well).

      Throws:
        `java.io.IOException`

    - #### getDocIdSet

          public DocIdSet getDocIdSet(IndexReader reader)
                               throws java.io.IOException

      Returns a DocIdSet with documents that should be permitted in search results.
      Overrides:
        `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:
        `java.io.IOException`
      See Also:
        `DocIdBitSet`

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