fr.gouv.culture.sdx.search.lucene.filter
Class Filter

java.lang.Object
  extended by org.apache.lucene.search.Filter
      extended by fr.gouv.culture.sdx.search.lucene.filter.AbstractFilter
          extended by fr.gouv.culture.sdx.search.lucene.filter.Filter
All Implemented Interfaces:
FilterCriteria, java.io.Serializable, org.apache.avalon.framework.logger.LogEnabled, org.apache.excalibur.xml.sax.XMLizable

public class Filter
extends AbstractFilter

A filter on a base of documents. This definition of filter is very generic. It is composed of a tree of criteria (Criteria objects), these criteria being connected by Boolean operators (AND or OR). One identifies the documents which respect this filter by making a Boolean logic adapted for each criteria.

See Also:
Serialized Form

Field Summary
static int BOOLEAN_OPERATOR_AND
          The "AND" operator
static int BOOLEAN_OPERATOR_NOT
          The "NOT" operator
static int BOOLEAN_OPERATOR_OR
          The "OR" operator
 
Fields inherited from class fr.gouv.culture.sdx.search.lucene.filter.AbstractFilter
logger
 
Constructor Summary
Filter()
           
Filter(int operator)
          Constructs a new filter with the specified operator
 
Method Summary
 void add(FilterCriteria criteria)
          Adds a criteria to the list.
 java.util.BitSet bits(org.apache.lucene.index.IndexReader r)
          Returns a list of documents which respect this filter.
 void setUp(int operator)
          Builds a filter of several criterion connected by an operator.
 void toSAX(org.xml.sax.ContentHandler hdl)
          Returns a SAX representation of this criteria.
 
Methods inherited from class fr.gouv.culture.sdx.search.lucene.filter.AbstractFilter
enableLogging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN_OPERATOR_AND

public static final int BOOLEAN_OPERATOR_AND
The "AND" operator

See Also:
Constant Field Values

BOOLEAN_OPERATOR_OR

public static final int BOOLEAN_OPERATOR_OR
The "OR" operator

See Also:
Constant Field Values

BOOLEAN_OPERATOR_NOT

public static final int BOOLEAN_OPERATOR_NOT
The "NOT" operator

See Also:
Constant Field Values
Constructor Detail

Filter

public Filter()

Filter

public Filter(int operator)
Constructs a new filter with the specified operator

Parameters:
operator - The operator for the filter
Method Detail

setUp

public void setUp(int operator)
Builds a filter of several criterion connected by an operator.

Parameters:
operator - The operator (AND or OR) connecting the criterion .

add

public void add(FilterCriteria criteria)
Adds a criteria to the list.

Parameters:
criteria - A criteria or a list of criterion

bits

public java.util.BitSet bits(org.apache.lucene.index.IndexReader r)
Returns a list of documents which respect this filter. To obtain this list, the lists provided by all the children of this filter are compiled

Specified by:
bits in interface FilterCriteria
Specified by:
bits in class AbstractFilter
Parameters:
r - An object for reading the index.

toSAX

public void toSAX(org.xml.sax.ContentHandler hdl)
           throws org.xml.sax.SAXException
Returns a SAX representation of this criteria.

Parameters:
hdl - The ContentHandler to which the events will be supplied.
Throws:
org.xml.sax.SAXException


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.