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
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
- "invalid input: '<'" (older, default) or "invalid input: '<'=" (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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields 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 TypeMethodDescriptionbooleancanFilter(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.getFacetExtractor(Predicate p, EvaluationContext context) Default implementation that always returnsnull, ie.getXPathExpression(Predicate p, EvaluationContext context) Default implementation that always returnsnull, ie.static StringparseDateString(String dateString, String timeZoneID, Session session) Methods inherited from class com.day.cq.search.eval.RangePropertyPredicateEvaluator
getOrderByProperties, includesMethods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getOrderByComparator, isFiltering
-
Field Details
-
TIME_ZONE
- See Also:
-
TODAY
- See Also:
-
THIS_WEEK
- See Also:
-
THIS_MONTH
- See Also:
-
LAST_THREE_MONTHS
- See Also:
-
THIS_YEAR
- See Also:
-
LAST_YEAR
- See Also:
-
EARLIER_THAN_LAST_YEAR
- See Also:
-
-
Constructor Details
-
DateRangePredicateEvaluator
public DateRangePredicateEvaluator()
-
-
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 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
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
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
-
getFacetExtractor
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
-