Package com.day.cq.search.eval
Class SavedQueryPredicate
- java.lang.Object
-
- com.day.cq.search.eval.AbstractPredicateEvaluator
-
- com.day.cq.search.eval.PredicateGroupEvaluator
-
- com.day.cq.search.eval.SavedQueryPredicate
-
- All Implemented Interfaces:
PredicateEvaluator
public class SavedQueryPredicate extends PredicateGroupEvaluator
Includes all predicates of a persisted querybuilder query into the current query as a subPredicateGroupEvaluator
. Note that this will not execute an extra query but extend the current query.Queries can be persisted programmatically using QueryBuilder#storeQuery(). The format can be either a multi-line String property or a nt:file node that contains the query as a text file in Java properties format.
Does not support facet extraction for the predicates of the saved query.
Name:
savedqueryParameters:
- savedquery
- path to the saved query (String property or nt:file node)
- Since:
- 5.3
-
-
Field Summary
Fields Modifier and Type Field Description QueryBuilder
queryBuilder
static String
SAVED_QUERY
-
Constructor Summary
Constructors Constructor Description SavedQueryPredicate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canFilter(Predicate p, EvaluationContext context)
Returns the same as the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)
method (ie.boolean
canXpath(Predicate p, EvaluationContext context)
Returns the inverted boolean value of the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)
method (ie.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.PredicateGroupEvaluator
getFacetExtractor, listFilteringPredicates
-
Methods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getOrderByComparator, getOrderByProperties, isFiltering
-
-
-
-
Field Detail
-
SAVED_QUERY
public static final String SAVED_QUERY
- See Also:
- Constant Field Values
-
queryBuilder
@Reference public QueryBuilder queryBuilder
-
-
Method Detail
-
getXPathExpression
public 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 classPredicateGroupEvaluator
- 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 classPredicateGroupEvaluator
- 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
-
canXpath
public boolean canXpath(Predicate p, 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 classPredicateGroupEvaluator
- Parameters:
p
- 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 p, 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 classPredicateGroupEvaluator
- Parameters:
p
- 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)
-
-