org.apache.lucene.misc

Class ChainedFilter

public class ChainedFilter extends Filter

Allows multiple {@link 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.

Author: Kelvin Tan

Field Summary
static intAND
{@link BitSet#and}.
static intANDNOT
{@link BitSet#andNot}.
static intDEFAULT
Logical operation when none is declared.
static intOR
{@link BitSet#or}.
static intXOR
{@link 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)
{@link Filter#bits}.
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
{@link BitSet#and}.

ANDNOT

public static final int ANDNOT
{@link BitSet#andNot}.

DEFAULT

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

OR

public static final int OR
{@link BitSet#or}.

XOR

public static final int XOR
{@link 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)
{@link Filter#bits}.

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-2008 Apache Software Foundation. All Rights Reserved.