Package com.day.cq.search.eval
Class PathPredicateEvaluator
- java.lang.Object
-
- com.day.cq.search.eval.AbstractPredicateEvaluator
-
- com.day.cq.search.eval.PathPredicateEvaluator
-
- All Implemented Interfaces:
PredicateEvaluator
public class PathPredicateEvaluator extends AbstractPredicateEvaluator
Searches within a given path.Does not support facet extraction.
Name:
pathProperties:
- path
- path pattern; depending on
exact
, either the entire subtree will match (like appending //* in xpath, but note that this does not include the base path) (exact=false, default) or only an exact path matches, which can include wildcards (*); ifself
is set, the entire subtree including the base node will be searched - exact
- if exact is true/on, the exact path must match, but it can contain simple wildcards (*), that match names, but not "/"; if it is false (default) all descendents are included (optional)
- flat
- searches only the direct children (like appending "/*" in xpath) (only used if 'exact' is not true, optional)
- self
- searches the subtree but includes the base node given as path (no wildcards)
- Since:
- 5.2
-
-
Constructor Summary
Constructors Constructor Description PathPredicateEvaluator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canFilter(Predicate predicate, EvaluationContext context)
Returns the same as the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)
method (ie.boolean
canXpath(Predicate predicate, EvaluationContext context)
Returns the inverted boolean value of the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)
method (ie.static java.lang.String
encodePath(Predicate p)
Encodes absolute paths, but keeps wildcards in case this is an "exact" query containing wildcards.java.util.Comparator<Row>
getOrderByComparator(Predicate predicate, EvaluationContext context)
Default implementation that always returnsnull
.java.lang.String
getXPathExpression(Predicate p, EvaluationContext context)
Default implementation that always returnsnull
, ie.boolean
includes(Predicate p, Row row, EvaluationContext context)
Default implementation that always returnstrue
, ie.-
Methods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getFacetExtractor, getOrderByProperties, isFiltering
-
-
-
-
Field Detail
-
PATH
public static final java.lang.String PATH
- See Also:
- Constant Field Values
-
EXACT
public static final java.lang.String EXACT
- See Also:
- Constant Field Values
-
FLAT
public static final java.lang.String FLAT
- See Also:
- Constant Field Values
-
SELF
public static final java.lang.String SELF
- See Also:
- Constant Field Values
-
-
Method Detail
-
encodePath
public static java.lang.String encodePath(Predicate p)
Encodes absolute paths, but keeps wildcards in case this is an "exact" query containing wildcards.
-
getXPathExpression
public java.lang.String getXPathExpression(Predicate p, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluator
Default 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:
getXPathExpression
in interfacePredicateEvaluator
- Overrides:
getXPathExpression
in classAbstractPredicateEvaluator
- 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
-
includes
public boolean includes(Predicate p, Row row, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluator
Default implementation that always returnstrue
, ie. it does not "touch" the result set at all.- Specified by:
includes
in interfacePredicateEvaluator
- Overrides:
includes
in classAbstractPredicateEvaluator
- Parameters:
p
- predicate (for this evaluator type) which is evaluatedrow
- current row of the result set returned through the xpath querycontext
- helper class which provides access to various elements of the query evaluation- Returns:
true
if this row should be part of the final result set,false
if it should be dropped
-
getOrderByComparator
public java.util.Comparator<Row> getOrderByComparator(Predicate predicate, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluator
Default implementation that always returnsnull
.- Specified by:
getOrderByComparator
in interfacePredicateEvaluator
- Overrides:
getOrderByComparator
in classAbstractPredicateEvaluator
- Parameters:
predicate
- predicate (for this evaluator type) which is evaluatedcontext
- helper class which provides access to various elements of the query evaluation- Returns:
- a custom comparator for the given predicate or
null
-
canXpath
public boolean canXpath(Predicate predicate, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluator
Returns the inverted boolean value of the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)
method (ie. if not overridden,true
).- Specified by:
canXpath
in interfacePredicateEvaluator
- Overrides:
canXpath
in classAbstractPredicateEvaluator
- Parameters:
predicate
- predicate (for this evaluator type) which is evaluatedcontext
- helper class which provides access to various elements of the query evaluation- Returns:
true
if this evaluator can express itself via xpath, ie.PredicateEvaluator.getXPathExpression(Predicate, EvaluationContext)
-
canFilter
public boolean canFilter(Predicate predicate, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluator
Returns the same as the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)
method (ie. if not overridden,false
).- Specified by:
canFilter
in interfacePredicateEvaluator
- Overrides:
canFilter
in classAbstractPredicateEvaluator
- Parameters:
predicate
- predicate (for this evaluator type) which is evaluatedcontext
- helper class which provides access to various elements of the query evaluation- Returns:
true
if this evaluator can be express itself via filtering, ie.PredicateEvaluator.includes(Predicate, Row, EvaluationContext)
-
-