fr.gouv.culture.sdx.search.lucene.query
Class ComplexQuery

java.lang.Object
  extended byfr.gouv.culture.sdx.utils.SdxObjectImpl
      extended byfr.gouv.culture.sdx.search.lucene.query.AbstractQuery
          extended byfr.gouv.culture.sdx.search.lucene.query.ComplexQuery
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, Query, Query, SdxObject, org.apache.cocoon.xml.XMLizable

public class ComplexQuery
extends AbstractQuery

A complex boolean query, reprenseted as a tree.

Any boolean query can be represented by a complex query. It is made of search criterias linked with a boolean operator. All criterias are themselves any type of Lucene query, so the model is recursive.


Field Summary
 
Fields inherited from class fr.gouv.culture.sdx.search.lucene.query.AbstractQuery
baseOperator, baseQuery, baseResults, filter, luceneQuery, queryText, searchLocations, sortSpecification
 
Fields inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl
encoding, logger
 
Fields inherited from interface fr.gouv.culture.sdx.search.lucene.query.Query
defaultOperator, OPERATOR_AND, OPERATOR_NOT, OPERATOR_OR, SEARCH_ENGINE
 
Constructor Summary
ComplexQuery()
          Creates a query A logger must be set and then this query must be setUp.
 
Method Summary
 void addComponent(Query component)
          Adds a component to this query.
 AbstractFilter prepare()
          Prepares the query to make it executable.
 void setUp(SearchLocations sLocs, int operator)
          Builds a complex query for an index using an operator.
 int size()
          Returns the number of components for this query.
 void toSAX(org.xml.sax.ContentHandler hdl)
          Formats this query in XML.
 
Methods inherited from class fr.gouv.culture.sdx.search.lucene.query.AbstractQuery
addAttributesLucene, addAttributesText, addBaseQuery, addBaseQuery, addFilter, addSortSpecification, enableLogging, execute, getLuceneQuery, getOperator, getSearchLocations, setLuceneQuery, setSearchLocations, setUp, setUp
 
Methods inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl
getChildLogger, setEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.gouv.culture.sdx.utils.SdxObject
setEncoding
 

Constructor Detail

ComplexQuery

public ComplexQuery()
Creates a query

A logger must be set and then this query must be setUp.

See Also:
AbstractQuery.enableLogging(org.apache.avalon.framework.logger.Logger), setUp(fr.gouv.culture.sdx.search.lucene.query.SearchLocations, int)
Method Detail

setUp

public void setUp(SearchLocations sLocs,
                  int operator)
           throws SDXException
Builds a complex query for an index using an operator.

Parameters:
sLocs - The SearchLocations object (indices to be searched).
operator - The operator linking the components.
Throws:
SDXException

prepare

public AbstractFilter prepare()
Prepares the query to make it executable.

This method will basically call the prepare methods of its components and merge the filters.

Specified by:
prepare in interface Query
Overrides:
prepare in class AbstractQuery

addComponent

public void addComponent(Query component)
Adds a component to this query.

Parameters:
component - The component to add.

size

public int size()
Returns the number of components for this query.


toSAX

public void toSAX(org.xml.sax.ContentHandler hdl)
           throws org.xml.sax.SAXException,
                  org.apache.cocoon.ProcessingException
Formats this query in XML.

Specified by:
toSAX in interface Query
Specified by:
toSAX in class AbstractQuery
Parameters:
hdl - The content handler that will receive the events.
Throws:
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException


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