org.apache.lucene.misc

## Class ChainedFilter

- java.lang.Object
- - org.apache.lucene.search.Filter
  - - org.apache.lucene.misc.ChainedFilter

- All Implemented Interfaces:
    java.io.Serializable

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

  Allows multiple `Filter`s to be chained. Logical operations such as NOT and XOR are applied between filters. One operation can be used for all filters, or a specific operation can be declared for each filter.

  Order in which filters are called depends on the position of the filter in the chain. It's probably more efficient to place the most restrictive filters /least computationally-intensive filters first.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `AND`
    `static int` | `ANDNOT`
    `static int` | `DEFAULT` Logical operation when none is declared.
    `static int` | `OR`
    `static int` | `XOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChainedFilter(org.apache.lucene.search.Filter[] chain)` Ctor.
    `ChainedFilter(org.apache.lucene.search.Filter[] chain, int logic)` Ctor.
    `ChainedFilter(org.apache.lucene.search.Filter[] chain, int[] logicArray)` Ctor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `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)` `Filter.getDocIdSet(org.apache.lucene.index.IndexReader)`.
    `java.lang.String` | `toString()`

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

      `bits`

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

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

- - ### Field Detail

    - #### OR

          public static final int OR

      See Also:
        Constant Field Values

    - #### AND

          public static final int AND

      See Also:
        Constant Field Values

    - #### ANDNOT

          public static final int ANDNOT

      See Also:
        Constant Field Values

    - #### XOR

          public static final int XOR

      See Also:
        Constant Field Values

    - #### DEFAULT

          public static int DEFAULT

      Logical operation when none is declared. Defaults to OR.

  - ### Constructor Detail

    - #### ChainedFilter

          public ChainedFilter(org.apache.lucene.search.Filter[] chain)

      Ctor.
      Parameters:
        `chain` - The chain of filters

    - #### ChainedFilter

          public ChainedFilter(org.apache.lucene.search.Filter[] chain,
                               int[] logicArray)

      Ctor.
      Parameters:
        `chain` - The chain of filters
        `logicArray` - Logical operations to apply between filters

    - #### ChainedFilter

          public ChainedFilter(org.apache.lucene.search.Filter[] chain,
                               int logic)

      Ctor.
      Parameters:
        `chain` - The chain of filters
        `logic` - Logical operation to apply to ALL filters

  - ### Method Detail

    - #### getDocIdSet

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

      `Filter.getDocIdSet(org.apache.lucene.index.IndexReader)`.
      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

    - #### toString

          public java.lang.String toString()

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

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