org.apache.lucene.misc

Class ChainedFilter

Implemented Interfaces:
Serializable

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
See Also:
Serialized Form

Field Summary

static int
AND
BitSet.and.
static int
ANDNOT
BitSet.andNot.
static int
DEFAULT
Logical operation when none is declared.
static int
OR
BitSet.or.
static int
XOR
BitSet.xor.

Constructor Summary

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

Method Summary

BitSet
bits(IndexReader reader)
Filter.bits(IndexReader).
String
toString()

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

bits

Field Details

AND

public static final int AND
BitSet.and.
Field Value:
1

ANDNOT

public static final int ANDNOT
BitSet.andNot.
Field Value:
2

DEFAULT

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

OR

public static final int OR
BitSet.or.
Field Value:
0

XOR

public static final int XOR
BitSet.xor.
Field Value:
3

Constructor Details

ChainedFilter

public ChainedFilter(Filter[] chain)
Ctor.
Parameters:
chain - The chain of filters

ChainedFilter

public ChainedFilter(Filter[] chain,
                     int logic)
Ctor.
Parameters:
chain - The chain of filters
logic - Logicial operation to apply to ALL filters

ChainedFilter

public ChainedFilter(Filter[] chain,
                     int[] logicArray)
Ctor.
Parameters:
chain - The chain of filters
logicArray - Logical operations to apply between filters

Method Details

bits

public BitSet bits(IndexReader reader)
            throws IOException
Overrides:
bits in interface Filter

toString

public String toString()

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