Package org.ametys.cms.search.query
Class AbstractRangeQuery<T>
java.lang.Object
org.ametys.cms.search.query.AbstractRangeQuery<T>
- Type Parameters:
T
- the value type.
- All Implemented Interfaces:
Query
- Direct Known Subclasses:
DateRangeQuery
,DoubleRangeQuery
,LongRangeQuery
Base class for all range-based queries.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.cms.search.query.Query
Query.LogicalOperator, Query.Operator
-
Field Summary
Fields inherited from interface org.ametys.cms.search.query.Query
BOOL_FILTER, BOOL_MUST, BOOL_MUST_NOT, BOOL_SHOULD
-
Constructor Summary
ConstructorDescriptionAbstractRangeQuery
(String fieldName, T lowerBound, T upperBound, boolean includeLower, boolean includeUpper) Build a range query. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the solr query string representing the Query object.boolean
Returns the Solr field name.Returns the lower bound of the range.Returns the upper bound of the range.int
hashCode()
boolean
Returns true if the query should include the lower bound.boolean
Returns true if the query should include the upper bound.lowerBoundForQuery
(T value) Computes the lower bound for Solr clientupperBoundForQuery
(T value) Computes the upper bound for Solr clientMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.cms.search.query.Query
buildAsJson, rewrite, toString
-
Constructor Details
-
AbstractRangeQuery
public AbstractRangeQuery(String fieldName, T lowerBound, T upperBound, boolean includeLower, boolean includeUpper) Build a range query.- Parameters:
fieldName
- The field path.lowerBound
- The lower end of the range.upperBound
- The upper end of the range.includeLower
- Whether to include the lower end or not.includeUpper
- Whether to include the upper end or not.
-
-
Method Details
-
getFieldName
Returns the Solr field name.- Returns:
- the field name
-
includeLowerBound
Returns true if the query should include the lower bound.- Returns:
- true if the query should include the lower bound.
-
includeUpperBound
Returns true if the query should include the upper bound.- Returns:
- true if the query should include the upper bound.
-
getLowerBound
Returns the lower bound of the range.- Returns:
- the lower bound of the range.
-
getUpperBound
Returns the upper bound of the range.- Returns:
- the upper bound of the range.
-
lowerBoundForQuery
Computes the lower bound for Solr client- Parameters:
value
- the typed value- Returns:
- the value, adapted for Solr
-
upperBoundForQuery
Computes the upper bound for Solr client- Parameters:
value
- the typed value- Returns:
- the value, adapted for Solr
-
build
Description copied from interface:Query
Build the solr query string representing the Query object.- Specified by:
build
in interfaceQuery
- Returns:
- the solr query string representing the Query object.
- Throws:
QuerySyntaxException
- if the query can't be built because of a syntax error.
-
hashCode
-
equals
-