Package com.day.cq.search.eval
Class PredicateGroupEvaluator
java.lang.Object
com.day.cq.search.eval.AbstractPredicateEvaluator
com.day.cq.search.eval.PredicateGroupEvaluator
- All Implemented Interfaces:
PredicateEvaluator
- Direct Known Subclasses:
SavedQueryPredicate
Allows to build nested conditions. Groups can contain nested groups.
Everything in a querybuilder query is implicitly in a root group, which
can have
p.or and p.not as well.
Example for matching either one of two properties against a value:
group.p.or=true
group.1_property=jcr:title
group.1_property.value=My Page
group.2_property=navTitle
group.2_property.value=My Page
This is conceptually (1_property OR 2_property).
Example for nested groups:
fulltext=Management
group.p.or=true
group.1_group.path=/content/geometrixx/en
group.1_group.type=cq:Page
group.2_group.path=/content/dam/geometrixx
group.2_group.type=dam:Asset
This searches for the term "Management" within pages in /content/geometrixx/en
or in assets in /content/dam/geometrixx. This is conceptually
fulltext AND ( (path AND type) OR (path AND type) ).
Be aware that such OR joins need good indexes for performance.
Name:
groupProperties:
- p.or
- if set to "true", only one predicate in the group must match (defaults to "false", meaning all must match)
- p.not
- if set to "true", negates the group (defaults to "false")
- <predicate>
- add nested predicates
- N_<predicate>
- add multiple nested predicates of the same time, e.g. 1_property, 2_property, ...
- Since:
- 5.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanFilter(Predicate predicate, EvaluationContext context) Returns the same as the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)method (ie.booleancanXpath(Predicate predicate, EvaluationContext context) Returns the inverted boolean value of the deprecatedAbstractPredicateEvaluator.isFiltering(Predicate, EvaluationContext)method (ie.getFacetExtractor(Predicate predicate, EvaluationContext context) Default implementation that always returnsnull, ie.getXPathExpression(Predicate p, EvaluationContext context) Default implementation that always returnsnull, ie.booleanincludes(Predicate p, Row row, EvaluationContext context) Default implementation that always returnstrue, ie.listFilteringPredicates(PredicateGroup group, EvaluationContext context) Methods inherited from class com.day.cq.search.eval.AbstractPredicateEvaluator
getOrderByComparator, getOrderByProperties, isFiltering
-
Constructor Details
-
PredicateGroupEvaluator
public PredicateGroupEvaluator()
-
-
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 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
Description copied from class:AbstractPredicateEvaluatorDefault implementation that always returnstrue, ie. it does not "touch" the result set at all.- Specified by:
includesin interfacePredicateEvaluator- Overrides:
includesin 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:
trueif this row should be part of the final result set,falseif it should be dropped
-
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 classAbstractPredicateEvaluator- Parameters:
predicate- 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)
-
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 classAbstractPredicateEvaluator- Parameters:
predicate- 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)
-
listFilteringPredicates
-
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:
predicate- 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
-