public class

ChainedFilter

extends Filter
java.lang.Object
   ↳ org.apache.lucene.search.Filter
     ↳ org.apache.lucene.search.ChainedFilter

Class Overview

Allows multiple Filters 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.

Summary

Constants
int AND
int ANDNOT
int OR
int XOR
Fields
public static int DEFAULT Logical operation when none is declared.
Public Constructors
ChainedFilter(Filter[] chain)
Ctor.
ChainedFilter(Filter[] chain, int[] logicArray)
Ctor.
ChainedFilter(Filter[] chain, int logic)
Ctor.
Public Methods
DocIdSet getDocIdSet(IndexReader reader)
String toString()
Protected Methods
@Deprecated final DocIdSet finalResult(OpenBitSetDISI result, int maxDocs)
This method is deprecated. Either use CachingWrapperFilter, or switch to a different DocIdSet implementation yourself. This method will be removed in Lucene 4.0
[Expand]
Inherited Methods
From class org.apache.lucene.search.Filter
From class java.lang.Object

Constants

public static final int AND

Constant Value: 1 (0x00000001)

public static final int ANDNOT

Constant Value: 2 (0x00000002)

public static final int OR

Constant Value: 0 (0x00000000)

public static final int XOR

Constant Value: 3 (0x00000003)

Fields

public static int DEFAULT

Logical operation when none is declared. Defaults to OR.

Public Constructors

public ChainedFilter (Filter[] chain)

Ctor.

Parameters
chain The chain of filters

public ChainedFilter (Filter[] chain, int[] logicArray)

Ctor.

Parameters
chain The chain of filters
logicArray Logical operations to apply between filters

public ChainedFilter (Filter[] chain, int logic)

Ctor.

Parameters
chain The chain of filters
logic Logical operation to apply to ALL filters

Public Methods

public DocIdSet getDocIdSet (IndexReader reader)

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

public String toString ()

Protected Methods

@Deprecated protected final DocIdSet finalResult (OpenBitSetDISI result, int maxDocs)

This method is deprecated.
Either use CachingWrapperFilter, or switch to a different DocIdSet implementation yourself. This method will be removed in Lucene 4.0

Provide a SortedVIntList when it is definitely smaller than an OpenBitSet