Package com.day.cq.search.eval
Class DateRangePredicateEvaluator
- java.lang.Object
 - 
- com.day.cq.search.eval.AbstractPredicateEvaluator
 - 
- com.day.cq.search.eval.RangePropertyPredicateEvaluator
 - 
- com.day.cq.search.eval.DateRangePredicateEvaluator
 
 
 
 
- 
- All Implemented Interfaces:
 PredicateEvaluator
- Direct Known Subclasses:
 RelativeDateRangePredicateEvaluator
public class DateRangePredicateEvaluator extends RangePropertyPredicateEvaluator
Matches JCR DATE properties against a date/time interval. This uses the ISO8601 format for dates and times (YYYY-MM-DDTHH:mm:ss.SSSZ) and allows also partial representations (eg.YYYY-MM-DD). Alternatively, the timestamp can be provided as number of milliseconds since 1970 (UTC timezone, the unix time format).You can ask for anything between two timestamps, anything newer or older than a given date, and also chose between inclusive and open intervals.
Supports facet extraction. Will provide buckets "today", "this week", "this month", "last 3 months", "this year", "last year" and "earlier than last year".
Does not support filtering.
Name:
daterangeProperties:
- property
 - relative path to a DATE property, for example 
jcr:lastModified - lowerBound
 - lower date bound to check property for, for example 
2014-10-01 - lowerOperation
 - ">" (newer, default) or ">=" (at or newer), applies to the lowerBound
 - upperBound
 - upper bound to check property for, for example 
2014-10-01T12:15:00 - upperOperation
 - "<" (older, default) or "<=" (at or older), applies to the upperBound
 - timeZone
 - ID of timezone to use when it's not given as ISO-8601 date string; default is the default timezone of the system
 
- Since:
 - 5.2
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEARLIER_THAN_LAST_YEARstatic java.lang.StringLAST_THREE_MONTHSstatic java.lang.StringLAST_YEARstatic java.lang.StringTHIS_MONTHstatic java.lang.StringTHIS_WEEKstatic java.lang.StringTHIS_YEARstatic java.lang.StringTIME_ZONEstatic java.lang.StringTODAY- 
Fields inherited from class com.day.cq.search.eval.RangePropertyPredicateEvaluator
LOWER_BOUND, LOWER_OPERATION, PROPERTY, PROPERTY_DECIMAL, UPPER_BOUND, UPPER_OPERATION 
 - 
 
- 
Constructor Summary
Constructors Constructor Description DateRangePredicateEvaluator() 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanFilter(Predicate p, EvaluationContext context)Returns the same as the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)method (ie.booleancanXpath(Predicate p, EvaluationContext context)Returns the inverted boolean value of the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)method (ie.FacetExtractorgetFacetExtractor(Predicate p, EvaluationContext context)Default implementation that always returnsnull, ie.java.lang.StringgetXPathExpression(Predicate p, EvaluationContext context)Default implementation that always returnsnull, ie.static java.lang.StringparseDateString(java.lang.String dateString, java.lang.String timeZoneID, javax.jcr.Session session)- 
Methods inherited from class com.day.cq.search.eval.RangePropertyPredicateEvaluator
getOrderByProperties, includes 
- 
Methods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getOrderByComparator, isFiltering 
 - 
 
 - 
 
- 
- 
Field Detail
- 
TIME_ZONE
public static final java.lang.String TIME_ZONE
- See Also:
 - Constant Field Values
 
 
- 
TODAY
public static final java.lang.String TODAY
- See Also:
 - Constant Field Values
 
 
- 
THIS_WEEK
public static final java.lang.String THIS_WEEK
- See Also:
 - Constant Field Values
 
 
- 
THIS_MONTH
public static final java.lang.String THIS_MONTH
- See Also:
 - Constant Field Values
 
 
- 
LAST_THREE_MONTHS
public static final java.lang.String LAST_THREE_MONTHS
- See Also:
 - Constant Field Values
 
 
- 
THIS_YEAR
public static final java.lang.String THIS_YEAR
- See Also:
 - Constant Field Values
 
 
- 
LAST_YEAR
public static final java.lang.String LAST_YEAR
- See Also:
 - Constant Field Values
 
 
- 
EARLIER_THAN_LAST_YEAR
public static final java.lang.String EARLIER_THAN_LAST_YEAR
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
getXPathExpression
public java.lang.String getXPathExpression(Predicate p, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluatorDefault implementation that always returnsnull, ie. adds nothing to the XPath query. Subclasses can choose whether they want to implement this method or use theAbstractPredicateEvaluator.includes(Predicate, Row, EvaluationContext)method for advanced filtering (or both).- Specified by:
 getXPathExpressionin interfacePredicateEvaluator- Overrides:
 getXPathExpressionin classRangePropertyPredicateEvaluator- Parameters:
 p- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 - string containing an XPath predicateEvaluator expression
 
 
- 
canFilter
public boolean canFilter(Predicate p, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluatorReturns the same as the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)method (ie. if not overridden,false).- Specified by:
 canFilterin interfacePredicateEvaluator- Overrides:
 canFilterin classRangePropertyPredicateEvaluator- Parameters:
 p- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 trueif this evaluator can be express itself via filtering, ie.PredicateEvaluator.includes(Predicate, Row, EvaluationContext)
 
- 
canXpath
public boolean canXpath(Predicate p, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluatorReturns the inverted boolean value of the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)method (ie. if not overridden,true).- Specified by:
 canXpathin interfacePredicateEvaluator- Overrides:
 canXpathin classRangePropertyPredicateEvaluator- Parameters:
 p- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 trueif this evaluator can express itself via xpath, ie.PredicateEvaluator.getXPathExpression(Predicate, EvaluationContext)
 
- 
parseDateString
public static java.lang.String parseDateString(java.lang.String dateString, java.lang.String timeZoneID, javax.jcr.Session session) 
- 
getFacetExtractor
public FacetExtractor getFacetExtractor(Predicate p, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluatorDefault implementation that always returnsnull, ie. no facets will be extracted for the predicate.- Specified by:
 getFacetExtractorin interfacePredicateEvaluator- Overrides:
 getFacetExtractorin classAbstractPredicateEvaluator- Parameters:
 p- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 - a 
FacetExtractorthat is used to create aFacetornullif no extractor shall be provided 
 
 - 
 
 -