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

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.DateIntervalQuery
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, Query, Query, SdxObject, org.apache.cocoon.xml.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.


Field Summary
protected  boolean _inclusive
           
 
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
DateIntervalQuery()
          Creates a query A logger 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)
          Formats a 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, prepare, 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
 

Field Detail

_inclusive

protected boolean _inclusive
Constructor Detail

DateIntervalQuery

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

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

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,
                  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).
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,
                  org.apache.cocoon.ProcessingException
Formats a query in XML.

Specified by:
toSAX in interface Query
Specified by:
toSAX in class AbstractQuery
Parameters:
hdl - The ContentHandler 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.