com.day.cq.search.eval
Class PathPredicateEvaluator

java.lang.Object
  extended by com.day.cq.search.eval.AbstractPredicateEvaluator
      extended by com.day.cq.search.eval.PathPredicateEvaluator
All Implemented Interfaces:
PredicateEvaluator

public class PathPredicateEvaluator
extends AbstractPredicateEvaluator

PathPredicateEvaluator restricts the result to a node path.

Properties:

path
path pattern that allows wildcards (*), but with exact=false (default) the path will be automatically appended with "//*"
exact
if exact is true/on, only the given node will be searched, otherwise (default behaviour) all descendents are included as well (optional)

Since:
5.2

Field Summary
static String EXACT
           
static String PATH
           
 
Constructor Summary
PathPredicateEvaluator()
           
 
Method Summary
 Comparator<Row> getOrderByComparator(Predicate predicate, EvaluationContext context)
          Default implementation that always returns null.
 String getXPathExpression(Predicate p, EvaluationContext context)
          Default implementation that always returns null, ie.
 boolean includes(Predicate p, Row row, EvaluationContext context)
          Default implementation that always returns true, ie.
 boolean isFiltering(Predicate p, EvaluationContext context)
          Default implementation that always returns false, because the AbstractPredicateEvaluator.includes(Predicate, Row, EvaluationContext) also always returns true in this implementation and hence does not filtering at all.
 
Methods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getFacetExtractor, getOrderByProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH

public static final String PATH
See Also:
Constant Field Values

EXACT

public static final String EXACT
See Also:
Constant Field Values
Constructor Detail

PathPredicateEvaluator

public PathPredicateEvaluator()
Method Detail

getXPathExpression

public String getXPathExpression(Predicate p,
                                 EvaluationContext context)
Description copied from class: AbstractPredicateEvaluator
Default implementation that always returns null, ie. adds nothing to the XPath query. Subclasses can choose whether they want to implement this method or use the AbstractPredicateEvaluator.includes(Predicate, Row, EvaluationContext) method for advanced filtering (or both).

Specified by:
getXPathExpression in interface PredicateEvaluator
Overrides:
getXPathExpression in class AbstractPredicateEvaluator
Parameters:
p - predicate (for this evaluator type) which is evaluated
context - helper class which provides access to various elements of the query evaluation
Returns:
string containing an XPath predicateEvaluator expression

isFiltering

public boolean isFiltering(Predicate p,
                           EvaluationContext context)
Description copied from class: AbstractPredicateEvaluator
Default implementation that always returns false, because the AbstractPredicateEvaluator.includes(Predicate, Row, EvaluationContext) also always returns true in this implementation and hence does not filtering at all.

Specified by:
isFiltering in interface PredicateEvaluator
Overrides:
isFiltering in class AbstractPredicateEvaluator
Parameters:
p - predicate (for this evaluator type) which is evaluated
context - helper class which provides access to various elements of the query evaluation
Returns:
true if this evaluator is filtering the result set for the given predicate

includes

public boolean includes(Predicate p,
                        Row row,
                        EvaluationContext context)
Description copied from class: AbstractPredicateEvaluator
Default implementation that always returns true, ie. it does not "touch" the result set at all.

Specified by:
includes in interface PredicateEvaluator
Overrides:
includes in class AbstractPredicateEvaluator
Parameters:
p - predicate (for this evaluator type) which is evaluated
row - current row of the result set returned through the xpath query
context - 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 Comparator<Row> getOrderByComparator(Predicate predicate,
                                            EvaluationContext context)
Description copied from class: AbstractPredicateEvaluator
Default implementation that always returns null.

Specified by:
getOrderByComparator in interface PredicateEvaluator
Overrides:
getOrderByComparator in class AbstractPredicateEvaluator
Parameters:
predicate - predicate (for this evaluator type) which is evaluated
context - helper class which provides access to various elements of the query evaluation
Returns:
a custom comparator for the given predicate or null


Copyright © 2009 Day Management AG. All Rights Reserved.