Package com.day.cq.search.eval
Class RelativeDateRangePredicateEvaluator
java.lang.Object
com.day.cq.search.eval.AbstractPredicateEvaluator
com.day.cq.search.eval.RangePropertyPredicateEvaluator
com.day.cq.search.eval.DateRangePredicateEvaluator
com.day.cq.search.eval.RelativeDateRangePredicateEvaluator
- All Implemented Interfaces:
PredicateEvaluator
Matches JCR DATE properties against a date/time interval using time offsets
relative to the current server time. You can specify lowerBound and upperBound
using either a millisecond value or the bugzilla syntax 1s 2m 3h 4d 5w 6M 7y
(one second, two minutes, three hours, four days, five weeks, six months, seven years).
Prefix with "-" to indicate a negative offset before the current time.
If you only specify lowerBound or upperBound, the other one will default to 0,
meaning the current time.
For example:
-
upperBound=1h(and no lowerBound) would select anything in the next hour -
lowerBound=-1d(and no upperBound) would select anything in the last 24 hours -
lowerBound=-6MandupperBound=-3Mwould select anything 6 months to 3 months old -
lowerBound=-1500andupperBound=5500would select anything between 1500 milliseconds in the past and 5500 milliseconds in the future -
lowerBound=1dandupperBound=2dwould select anything in the day after tomorrow
Note it does not take leap years into consideration and all months are 30 days.
Does not support filtering.
Supports facet extraction in the same way as the DateRangePredicateEvaluator.
Name:
relativedaterangeProperties:
- upperBound
- upper date bound in milliseconds or 1s 2m 3h 4d 5w 6M 7y (one second, two minutes, three hours, four days, five weeks, six months, seven years) relative to current server time, use "-" for negative offset
- lowerBound
- lower date bound in milliseconds or 1s 2m 3h 4d 5w 6M 7y (one second, two minutes, three hours, four days, five weeks, six months, seven years) relative to current server time, use "-" for negative offset
-
Field Summary
Fields inherited from class com.day.cq.search.eval.DateRangePredicateEvaluator
EARLIER_THAN_LAST_YEAR, LAST_THREE_MONTHS, LAST_YEAR, THIS_MONTH, THIS_WEEK, THIS_YEAR, TIME_ZONE, TODAYFields inherited from class com.day.cq.search.eval.RangePropertyPredicateEvaluator
LOWER_BOUND, LOWER_OPERATION, PROPERTY, PROPERTY_DECIMAL, UPPER_BOUND, UPPER_OPERATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetXPathExpression(Predicate p, EvaluationContext context) Default implementation that always returnsnull, ie.longparseDateRange(String daterange) Methods inherited from class com.day.cq.search.eval.DateRangePredicateEvaluator
canFilter, canXpath, getFacetExtractor, parseDateStringMethods inherited from class com.day.cq.search.eval.RangePropertyPredicateEvaluator
getOrderByProperties, includesMethods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getOrderByComparator, isFiltering
-
Constructor Details
-
RelativeDateRangePredicateEvaluator
public RelativeDateRangePredicateEvaluator()
-
-
Method Details
-
getXPathExpression
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 classDateRangePredicateEvaluator- 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
-
parseDateRange
- Throws:
NumberFormatException
-