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

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.search.lucene.query.AbstractQuery
          extended by fr.gouv.culture.sdx.search.lucene.query.DateIntervalQuery
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

public class DateIntervalQuery
extends AbstractQuery

A search for date intervals, opened or closed.

This query will only work on a Date field.

Two dates can be given : the first one gives the lower bound, the second one gives the upper bound. Bounds are inclusive NOT exclusive If only one of the two is not null, the query is unbounded. It is an error to give two null dates.


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
SdxObject.ConfigurationNode
 
Field Summary
protected  boolean _inclusive
           
 
Fields inherited from class fr.gouv.culture.sdx.search.lucene.query.AbstractQuery
baseOperator, baseQuery, baseResults, cachedQuery, filter, luceneQuery, queryText, searchLocations, sortSpecification
 
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized
 
Fields inherited from interface fr.gouv.culture.sdx.search.lucene.query.Query
defaultOperator, LUCENE_BOOLEAN_QUERY_MAX_CLAUSES, OPERATOR_AND, OPERATOR_NOT, OPERATOR_OR, SEARCH_ENGINE
 
Fields inherited from interface fr.gouv.culture.sdx.search.Query
CLASS_NAME_SUFFIX
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Constructor Summary
DateIntervalQuery()
          Creates a query A super.getLog() must be set and then this query must be setUp.
 
Method Summary
protected  void setLuceneRangeQuery(java.lang.String fieldName, java.lang.String lowerBound, java.lang.String upperBound, boolean inclusive)
           
 void setUp(SearchLocations sLocs, java.lang.String fieldName, java.util.Date beginDate, java.util.Date endDate)
          Buils a date interval query.
 void setUp(SearchLocations sLocs, java.lang.String fieldName, java.util.Date beginDate, java.util.Date endDate, boolean inclusive)
          Buils a date interval query.
 void setUpOai(SearchLocations sLocs, java.lang.String fieldName, java.util.Date beginDate, java.util.Date endDate)
          Buils a date interval query for oai responses.
 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, getBoost, getCachedQuery, getClassNameSuffix, getLuceneQuery, getOperator, getSearchLocations, initToSax, initVolatileObjectsToSax, prepare, setBoost, 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
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Identifiable
getId, setId
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Describable
getDescription, setDescription
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Encodable
getEncoding, setEncoding
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Localizable
getLocale, getXmlLang, setLocale, setXmlLang
 

Field Detail

_inclusive

protected boolean _inclusive
Constructor Detail

DateIntervalQuery

public DateIntervalQuery()
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, java.lang.String, java.util.Date, java.util.Date)
Method Detail

setUpOai

public void setUpOai(SearchLocations sLocs,
                     java.lang.String fieldName,
                     java.util.Date beginDate,
                     java.util.Date endDate)
              throws SDXException
Buils a date interval query for oai responses.

One of beginDate or endDate must be non null.

Parameters:
sLocs - The SearchLocations object (indices to be searched).
fieldName - The field name to search (if null or non existent, default field will be searched).
beginDate - The lower bound date (may be null).
endDate - The upper bound date (may be null).
Throws:
SDXException

setUp

public void setUp(SearchLocations sLocs,
                  java.lang.String fieldName,
                  java.util.Date beginDate,
                  java.util.Date endDate)
           throws SDXException
Buils a date interval query.

One of beginDate or endDate must be non null.

Parameters:
sLocs - The SearchLocations object (indices to be searched).
fieldName - The field name to search (if null or non existent, default field will be searched).
beginDate - The lower bound date (may be null).
endDate - The upper bound date (may be null).
Throws:
SDXException

setUp

public void setUp(SearchLocations sLocs,
                  java.lang.String fieldName,
                  java.util.Date beginDate,
                  java.util.Date endDate,
                  boolean inclusive)
           throws SDXException
Buils a date interval query.

One of beginDate or endDate must be non null.

Parameters:
sLocs - The SearchLocations object (indices to be searched).
fieldName - The field name to search (if null or non existent, default field will be searched).
beginDate - The lower bound date (may be null).
endDate - The upper bound date (may be null).
inclusive - Whether the bounds should be included in the request
Throws:
SDXException

setLuceneRangeQuery

protected void setLuceneRangeQuery(java.lang.String fieldName,
                                   java.lang.String lowerBound,
                                   java.lang.String upperBound,
                                   boolean inclusive)

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 ContentHandler that will receive the events.
Throws:
org.xml.sax.SAXException


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