org.apache.lucene.misc

Class ChainedFilter

public class ChainedFilter extends Filter

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.

Author: Kelvin Tan

Field Summary
static intAND
BitSet#and.
static intANDNOT
BitSet#andNot.
static intDEFAULT
Logical operation when none is declared.
static intOR
BitSet#or.
static intXOR
BitSet#xor.
Constructor Summary
ChainedFilter(Filter[] chain)
Ctor.
ChainedFilter(Filter[] chain, int[] logicArray)
Ctor.
ChainedFilter(Filter[] chain, int logic)
Ctor.
Method Summary
BitSetbits(IndexReader reader)
StringtoString()
First AND operation takes place against a completely false bitset and will always return zero results.

Field Detail

AND

public static final int AND
BitSet#and.

ANDNOT

public static final int ANDNOT
BitSet#andNot.

DEFAULT

public static int DEFAULT
Logical operation when none is declared. Defaults to BitSet#or.

OR

public static final int OR
BitSet#or.

XOR

public static final int XOR
BitSet#xor.

Constructor Detail

ChainedFilter

public ChainedFilter(Filter[] chain)
Ctor.

Parameters: chain The chain of filters

ChainedFilter

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

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

ChainedFilter

public ChainedFilter(Filter[] chain, int logic)
Ctor.

Parameters: chain The chain of filters logic Logicial operation to apply to ALL filters

Method Detail

bits

public BitSet bits(IndexReader reader)
Filter.

toString

public String toString()
First AND operation takes place against a completely false bitset and will always return zero results. Thanks to Daniel Armbrust for pointing this out and suggesting workaround.
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.