Class Criteria
java.lang.Object
org.springframework.data.solr.core.query.Node
org.springframework.data.solr.core.query.Criteria
- Direct Known Subclasses:
AnyCriteria,Crotch,SimpleStringCriteria
Criteria is the central class when constructing queries. It follows more or less a fluent API style, which allows to
easily chain together multiple criteria.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classSingle entry to be used when defining search criteria -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCombine node with newNodefor given fieldname using and.Combine twoNodes using and.Crates newCriteria.PredicateforRANGE [lowerBound TO upperBound]between(Object lowerBound, Object upperBound, boolean includeLowerBound, boolean includeUppderBound) Crates newCriteria.PredicateforRANGE [lowerBound TO upperBound]boost(float boost) Boost positive hit with given factor.connect()Explicitly connectCriteriawith another one allows to create explicit bracketing.Crates newCriteria.Predicatewith leading and trailing wildcards for each entry
NOTE: mind your schema as leading wildcards may not be supported and/or execution might be slow.Crates newCriteria.Predicatewith leading and trailing wildcards
NOTE: mind your schema as leading wildcards may not be supported and/or execution might be slow.Crates newCriteria.Predicatewith leading and trailing wildcards for each entry
NOTE: mind your schema as leading wildcards may not be supported and/or execution might be slow.Crates newCriteria.Predicatewith leading wildcard for each entry
NOTE: mind your schema and execution times as leading wildcards may not be supported.Crates newCriteria.Predicatewith leading wildcard
NOTE: mind your schema and execution times as leading wildcards may not be supported.Crates newCriteria.Predicatewith leading wildcard for each entry
NOTE: mind your schema and execution times as leading wildcards may not be supported.expression(String s) Crates newCriteria.Predicateallowing native solr expressionsCreatesCriteria.Predicatefor givenFunction.Crates newCriteria.Predicatewith trailing~Crates newCriteria.Predicatewith trailing~followed by levensteinDistancefloatgetBoost()Boost criteria valuegetField()Target fieldgreaterThan(Object lowerBound) Crates newCriteria.PredicateforRANGE {lowerBound TO *]greaterThanEqual(Object lowerBound) Crates newCriteria.PredicateforRANGE [lowerBound TO *]Crates newCriteria.Predicatefor multiple values(arg0 arg1 arg2 ...)Crates newCriteria.Predicatefor multiple values(arg0 arg1 arg2 ...)Creates newCriteria.Predicatewithout any wildcards for each entryCrates newCriteria.Predicatewithout any wildcards.Crates newCriteria.Predicatewithout any wildcards for each entrybooleanCrates newCriteria.Predicatefor!nullvaluesisNull()Crates newCriteria.PredicatefornullvaluesCrates newCriteria.PredicateforRANGE [* TO upperBound}lessThanEqual(Object upperBound) Crates newCriteria.PredicateforRANGE [* TO upperBound]near(org.springframework.data.geo.Box box) Creates newCriteria.Predicatefor!bboxwith exact coordinates.near(org.springframework.data.geo.Circle circle) Creates newCriteria.Predicatefor!circlefor a specified distance.near(org.springframework.data.geo.Point location, org.springframework.data.geo.Distance distance) Creates newCriteria.Predicatefor!bboxfor a specified distance.not()Negates current criteria usinng-operatorExplicitly wrapCriteriainside not operation.Combine node with newNodefor given fieldname using and.Combine twoNodes using or.Crates newCriteria.Predicatewith trailing~followed by distancestartsWith(Iterable<String> values) Crates newCriteria.Predicatewith trailing wildcard for each entrystartsWith(String s) Crates newCriteria.Predicatewith trailing wildcard
NOTE: Strings will not be automatically split on whitespace.startsWith(String... values) Crates newCriteria.Predicatewith trailing wildcard for each entrytoString()static CriteriaStatic factory method to create a new Criteria for field with given namestatic CriteriaStatic factory method to create a new Criteria for provided fieldstatic CriteriaStatic factory method to create a new Criteria for functionwithin(org.springframework.data.geo.Circle circle) Creates newCriteria.Predicatefor!getfilt.within(org.springframework.data.geo.Point location, org.springframework.data.geo.Distance distance) Creates newCriteria.Predicatefor!getfilt.Methods inherited from class org.springframework.data.solr.core.query.Node
getParent, getSiblings, hasSiblings, isOr, isRoot, setNegating, setParent, setPartIsOr
-
Field Details
-
WILDCARD
- See Also:
-
CRITERIA_VALUE_SEPERATOR
- See Also:
-
-
Constructor Details
-
Criteria
public Criteria() -
Criteria
- Parameters:
function-- Since:
- 1.1
-
Criteria
Creates a new Criteria for the Filed with provided name- Parameters:
fieldname-
-
Criteria
Creates a new Criteria for the given field- Parameters:
field-
-
-
Method Details
-
where
Static factory method to create a new Criteria for field with given name- Parameters:
fieldname- must not be null- Returns:
-
where
Static factory method to create a new Criteria for function- Parameters:
function- must not be null- Returns:
- Since:
- 1.1
-
where
Static factory method to create a new Criteria for provided field- Parameters:
field- must not be null- Returns:
-
is
Crates newCriteria.Predicatewithout any wildcards. Strings with blanks will be escaped"string\ with\ blank" -
is
Crates newCriteria.Predicatewithout any wildcards for each entry -
is
Creates newCriteria.Predicatewithout any wildcards for each entry -
isNull
Crates newCriteria.Predicatefornullvalues -
isNotNull
Crates newCriteria.Predicatefor!nullvalues -
contains
Crates newCriteria.Predicatewith leading and trailing wildcards
NOTE: mind your schema as leading wildcards may not be supported and/or execution might be slow. NOTE: Strings will not be automatically split on whitespace. -
contains
Crates newCriteria.Predicatewith leading and trailing wildcards for each entry
NOTE: mind your schema as leading wildcards may not be supported and/or execution might be slow. -
contains
Crates newCriteria.Predicatewith leading and trailing wildcards for each entry
NOTE: mind your schema as leading wildcards may not be supported and/or execution might be slow. -
startsWith
Crates newCriteria.Predicatewith trailing wildcard
NOTE: Strings will not be automatically split on whitespace.- Specified by:
startsWithin classNode- Parameters:
s-- Returns:
- Throws:
org.springframework.dao.InvalidDataAccessApiUsageException- for strings with whitespace
-
startsWith
Crates newCriteria.Predicatewith trailing wildcard for each entry- Specified by:
startsWithin classNode- Parameters:
values-- Returns:
- Throws:
org.springframework.dao.InvalidDataAccessApiUsageException- for strings with whitespace
-
startsWith
Crates newCriteria.Predicatewith trailing wildcard for each entry- Specified by:
startsWithin classNode- Parameters:
values-- Returns:
- Throws:
org.springframework.dao.InvalidDataAccessApiUsageException- for strings with whitespace
-
endsWith
Crates newCriteria.Predicatewith leading wildcard
NOTE: mind your schema and execution times as leading wildcards may not be supported. NOTE: Strings will not be automatically split on whitespace. -
endsWith
Crates newCriteria.Predicatewith leading wildcard for each entry
NOTE: mind your schema and execution times as leading wildcards may not be supported. -
endsWith
Crates newCriteria.Predicatewith leading wildcard for each entry
NOTE: mind your schema and execution times as leading wildcards may not be supported. -
not
Negates current criteria usinng-operator -
notOperator
Explicitly wrapCriteriainside not operation.- Returns:
- Since:
- 1.4
-
fuzzy
Crates newCriteria.Predicatewith trailing~ -
fuzzy
Crates newCriteria.Predicatewith trailing~followed by levensteinDistance -
sloppy
Crates newCriteria.Predicatewith trailing~followed by distance -
expression
Crates newCriteria.Predicateallowing native solr expressions- Specified by:
expressionin classNode- Parameters:
s-- Returns:
-
boost
Boost positive hit with given factor. eg. ^2.3 -
between
Crates newCriteria.PredicateforRANGE [lowerBound TO upperBound] -
between
public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound, boolean includeLowerBound, boolean includeUppderBound) Crates newCriteria.PredicateforRANGE [lowerBound TO upperBound] -
lessThan
Crates newCriteria.PredicateforRANGE [* TO upperBound} -
lessThanEqual
Crates newCriteria.PredicateforRANGE [* TO upperBound]- Specified by:
lessThanEqualin classNode- Parameters:
upperBound-- Returns:
-
greaterThan
Crates newCriteria.PredicateforRANGE {lowerBound TO *]- Specified by:
greaterThanin classNode- Parameters:
lowerBound-- Returns:
-
greaterThanEqual
Crates newCriteria.PredicateforRANGE [lowerBound TO *]- Specified by:
greaterThanEqualin classNode- Parameters:
lowerBound-- Returns:
-
in
Crates newCriteria.Predicatefor multiple values(arg0 arg1 arg2 ...) -
in
Crates newCriteria.Predicatefor multiple values(arg0 arg1 arg2 ...) -
within
public Criteria within(org.springframework.data.geo.Point location, @Nullable org.springframework.data.geo.Distance distance) Creates newCriteria.Predicatefor!getfilt.
Uses nonneutralmetricto set the localscoreproperty for the function. -
within
Creates newCriteria.Predicatefor!getfilt.- Parameters:
circle-- Returns:
- Since:
- 1.2
-
near
Creates newCriteria.Predicatefor!bboxwith exact coordinates. -
near
public Criteria near(org.springframework.data.geo.Point location, @Nullable org.springframework.data.geo.Distance distance) Creates newCriteria.Predicatefor!bboxfor a specified distance. The difference between this andwithinis this is approximate whilewithinis exact.
Uses nonneutralmetricto set the localscoreproperty for the function.- Specified by:
nearin classNode- Parameters:
location-distance-- Returns:
- Throws:
IllegalArgumentException- if location is nullorg.springframework.dao.InvalidDataAccessApiUsageException- if distance is negative
-
near
Creates newCriteria.Predicatefor!circlefor a specified distance. The difference between this andwithin(Circle)is this is approximate whilewithinis exact.
Uses nonneutralmetricto set the localscoreproperty for the function.- Parameters:
circle-- Returns:
- Since:
- 1.2
-
function
CreatesCriteria.Predicatefor givenFunction.- Specified by:
functionin classNode- Parameters:
function- must not be null- Returns:
- Throws:
IllegalArgumentException- if function is null- Since:
- 1.1
-
getField
Target field- Returns:
- null if not set
-
isNegating
public boolean isNegating()- Overrides:
isNegatingin classNode- Returns:
- true if
not()criteria
-
getBoost
public float getBoost()Boost criteria value- Returns:
Float.NaNif not set
-
getPredicates
- Returns:
- unmodifiable set of all
Criteria.Predicate
-
toString
-
connect
Explicitly connectCriteriawith another one allows to create explicit bracketing.- Returns:
- Since:
- 1.4
-
and
Description copied from class:NodeCombine twoNodes using and. -
and
Description copied from class:NodeCombine node with newNodefor given fieldname using and. -
or
Description copied from class:NodeCombine twoNodes using or. -
or
Description copied from class:NodeCombine node with newNodefor given fieldname using and.
-