Package com.day.cq.search.eval
Class JcrPropertyPredicateEvaluator
- java.lang.Object
-
- com.day.cq.search.eval.AbstractPredicateEvaluator
-
- com.day.cq.search.eval.JcrPropertyPredicateEvaluator
-
- All Implemented Interfaces:
PredicateEvaluator
- Direct Known Subclasses:
JcrBoolPropertyPredicateEvaluator
public class JcrPropertyPredicateEvaluator extends AbstractPredicateEvaluator
Matches on JCR properties and their values.Supports facet extraction. Will provide buckets for each unique property value in the results.
Name:
propertyProperties:
- property
- relative path to property, for example
jcr:title
- value
- value to check property for; follows the JCR property type to string conversions
- N_value
- use 1_value, 2_value, ... to check for multiple values (combined with OR by default, with AND if and=true) (since 5.3)
- and
- set to true for combining multiple values (N_value) with AND (since 5.3)
- operation
- "equals" for exact match (default), "unequals" for unequality comparison, "like" for using the jcr:like xpath function (optional), "not" for no match (eg. "not(@prop)" in xpath, value param will be ignored), "exists" for existence check (value can be true - property must exist, the default - or false - same as "not") , "equalsIgnoreCase" for case insensitive match, "unequalsIgnoreCase" for case insensitive unequality comparison
- depth
- number of wildcard levels underneath which the property/relative path can exist (for instance, property=size depth=2 will check node/size, node/*/size and node/*/*/size)
- Since:
- 5.2
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
AND
static java.lang.String
DEPTH
static int
MAX_NUMBER_OF_VALUES
static java.lang.String
OP_EQUALS
static java.lang.String
OP_EQUALS_IGNORE_CASE
static java.lang.String
OP_EXISTS
static java.lang.String
OP_LIKE
static java.lang.String
OP_NOT
static java.lang.String
OP_UNEQUALS
static java.lang.String
OP_UNEQUALS_IGNORE_CASE
static java.lang.String
OPERATION
static java.lang.String
PROPERTY
static java.lang.String
STEP
static java.lang.String
VALUE
-
Constructor Summary
Constructors Constructor Description JcrPropertyPredicateEvaluator()
-
Method Summary
All 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.FacetExtractor
getFacetExtractor(Predicate p, EvaluationContext context)
Default implementation that always returnsnull
, ie.java.lang.String[]
getOrderByProperties(Predicate p, 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
getOrderByComparator, isFiltering
-
-
-
-
Field Detail
-
PROPERTY
public static final java.lang.String PROPERTY
- See Also:
- Constant Field Values
-
VALUE
public static final java.lang.String VALUE
- See Also:
- Constant Field Values
-
OPERATION
public static final java.lang.String OPERATION
- See Also:
- Constant Field Values
-
OP_EQUALS
public static final java.lang.String OP_EQUALS
- See Also:
- Constant Field Values
-
OP_UNEQUALS
public static final java.lang.String OP_UNEQUALS
- See Also:
- Constant Field Values
-
OP_LIKE
public static final java.lang.String OP_LIKE
- See Also:
- Constant Field Values
-
OP_NOT
public static final java.lang.String OP_NOT
- See Also:
- Constant Field Values
-
OP_EXISTS
public static final java.lang.String OP_EXISTS
- See Also:
- Constant Field Values
-
OP_EQUALS_IGNORE_CASE
public static final java.lang.String OP_EQUALS_IGNORE_CASE
- See Also:
- Constant Field Values
-
OP_UNEQUALS_IGNORE_CASE
public static final java.lang.String OP_UNEQUALS_IGNORE_CASE
- See Also:
- Constant Field Values
-
AND
public static final java.lang.String AND
- See Also:
- Constant Field Values
-
DEPTH
public static final java.lang.String DEPTH
- See Also:
- Constant Field Values
-
STEP
public static final java.lang.String STEP
- See Also:
- Constant Field Values
-
MAX_NUMBER_OF_VALUES
public static final int MAX_NUMBER_OF_VALUES
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
getOrderByProperties
public java.lang.String[] getOrderByProperties(Predicate p, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluator
Default implementation that always returnsnull
.- Specified by:
getOrderByProperties
in interfacePredicateEvaluator
- Overrides:
getOrderByProperties
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:
- one or multiple relative paths to JCR properties or
null
-
getFacetExtractor
public FacetExtractor getFacetExtractor(Predicate p, EvaluationContext context)
Description copied from class:AbstractPredicateEvaluator
Default implementation that always returnsnull
, ie. no facets will be extracted for the predicate.- Specified by:
getFacetExtractor
in interfacePredicateEvaluator
- Overrides:
getFacetExtractor
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:
- a
FacetExtractor
that is used to create aFacet
ornull
if no extractor shall be provided
-
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
-
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)
-
-