fr.gouv.culture.sdx.search.lucene.query
Class ComplexQuery
java.lang.Object
fr.gouv.culture.sdx.utils.AbstractSdxObject
fr.gouv.culture.sdx.search.lucene.query.AbstractQuery
fr.gouv.culture.sdx.search.lucene.query.ComplexQuery
- All Implemented Interfaces:
- Query, Describable, Encodable, Identifiable, Localizable, SdxObject, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable
- Direct Known Subclasses:
- LinearComplexQueryBuilder
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.
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized |
Constructor Summary |
ComplexQuery()
Creates a query
A super.getLog() must be set and then this query must be setUp. |
Method Summary |
void |
addComponent(Query component)
Adds a component to this query. |
float |
getBoost()
Returns the boost on the query. |
Filter |
prepare()
Prepares the query to make it executable. |
protected Query |
removeLastComponent()
Removes the last component added from the list of components, and returns it. |
void |
setBoost(float boost)
Change the boost on the query. |
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)
Returns a SAX representation of this query.. |
Methods inherited from class fr.gouv.culture.sdx.search.lucene.query.AbstractQuery |
addAttributesLucene, addAttributesText, addBaseQuery, addBaseQuery, addFilter, addSortSpecification, execute, getCachedQuery, getClassNameSuffix, getLuceneQuery, getOperator, getSearchLocations, initToSax, initVolatileObjectsToSax, setBoost, setLuceneQuery, setSearchLocations, setUp, setUp |
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, verifyConfigurationResources |
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 |
getLog |
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled |
enableLogging |
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable |
contextualize |
Methods inherited from interface org.apache.avalon.framework.service.Serviceable |
service |
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable |
configure |
ComplexQuery
public ComplexQuery()
- Creates a query
A super.getLog() must be set and then this query must be setUp.
- See Also:
AbstractSdxObject.enableLogging(org.apache.avalon.framework.logger.Logger)
,
setUp(fr.gouv.culture.sdx.search.lucene.query.SearchLocations, int)
setBoost
public void setBoost(float boost)
- Description copied from interface:
Query
- Change the boost on the query.
This method changes the boost on the query to make it more significant.
- Overrides:
setBoost
in class AbstractQuery
getBoost
public float getBoost()
- Description copied from interface:
Query
- Returns the boost on the query.
This method returns the boost on the query.
- Overrides:
getBoost
in class AbstractQuery
- Returns:
- the boost value by a float.
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 Filter prepare()
- Prepares the query to make it executable.
This method will basically call the prepare methods of its
components and merge the filters.
- Overrides:
prepare
in class AbstractQuery
- Returns:
- A filter defined for this query.
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
- Returns a SAX representation of this query..
- Specified by:
toSAX
in interface org.apache.excalibur.xml.sax.XMLizable
- Specified by:
toSAX
in class AbstractQuery
- Parameters:
hdl
- The content handler that will receive the events.
- Throws:
org.xml.sax.SAXException
removeLastComponent
protected Query removeLastComponent()
- Removes the last component added from the list of components, and returns it.
- Returns:
- The last component, or null if no component added.
Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.