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

public abstract class AbstractRangeQuery<T> extends Object implements Query
Base class for all range-based queries.
  • 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

      public String getFieldName()
      Returns the Solr field name.
      Returns:
      the field name
    • includeLowerBound

      public boolean includeLowerBound()
      Returns true if the query should include the lower bound.
      Returns:
      true if the query should include the lower bound.
    • includeUpperBound

      public boolean includeUpperBound()
      Returns true if the query should include the upper bound.
      Returns:
      true if the query should include the upper bound.
    • getLowerBound

      public T getLowerBound()
      Returns the lower bound of the range.
      Returns:
      the lower bound of the range.
    • getUpperBound

      public T getUpperBound()
      Returns the upper bound of the range.
      Returns:
      the upper bound of the range.
    • lowerBoundForQuery

      public String lowerBoundForQuery(T value)
      Computes the lower bound for Solr client
      Parameters:
      value - the typed value
      Returns:
      the value, adapted for Solr
    • upperBoundForQuery

      public String upperBoundForQuery(T value)
      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 interface Query
      Returns:
      the solr query string representing the Query object.
      Throws:
      QuerySyntaxException - if the query can't be built because of a syntax error.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object