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
public class RelativeDateRangePredicateEvaluator extends DateRangePredicateEvaluator
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, TODAY 
- 
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 RelativeDateRangePredicateEvaluator() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetXPathExpression(Predicate p, EvaluationContext context)Default implementation that always returnsnull, ie.longparseDateRange(java.lang.String daterange)- 
Methods inherited from class com.day.cq.search.eval.DateRangePredicateEvaluator
canFilter, canXpath, getFacetExtractor, parseDateString 
- 
Methods inherited from class com.day.cq.search.eval.RangePropertyPredicateEvaluator
getOrderByProperties, includes 
- 
Methods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getOrderByComparator, isFiltering 
 - 
 
 - 
 
- 
- 
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 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
public long parseDateRange(java.lang.String daterange) throws java.lang.NumberFormatException- Throws:
 java.lang.NumberFormatException
 
 - 
 
 -