Class SearchRequest

java.lang.Object
com.massifmaps.search.SearchRequest

public class SearchRequest extends Object
A search request description. Contains various search filters,
including geometry proximity test, regular expression test for all attributes
and a custom SQL-like search filter.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty SearchRequest.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this object is equal to the specified object.
    Returns the string based search expression.
    If empty, then search expression is not used.
    Returns the geometry used for proximity search.
    Returns the projection to use for search geometry.
    Returns the regular expression used to search all the fields.
    If empty, then the regular expression is not used.
    float
    Returns the search radius for proximity search (in meters).
    int
    Returns the hash value of this object.
    void
    Sets the string based search expression.
    A various conditions based on the fields and geometry can be used.
    For example, "name='X' OR (name='Y' AND gender IS NOT NULL)" is a valid expression,
    assuming elements contains fields 'name' and 'gender'.
    Note: This feature is currently in experimental state and may change in the future!
    void
    Sets the geometry used for proximity search.
    If geometry is set, then projection must be also defined.
    void
    Sets the projection to use for search geometry.
    void
    Sets the regular expression used to search all the fields.
    void
    setSearchRadius(float radius)
    Sets the search radius for proximity search (in meters).
    Creates a string representation of this request object, useful for logging.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SearchRequest

      public SearchRequest()
      Constructs an empty SearchRequest.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getFilterExpression

      public String getFilterExpression()
      Returns the string based search expression.
      If empty, then search expression is not used.
      Returns:
      The string based search expression.
    • setFilterExpression

      public void setFilterExpression(String expr)
      Sets the string based search expression.
      A various conditions based on the fields and geometry can be used.
      For example, "name='X' OR (name='Y' AND gender IS NOT NULL)" is a valid expression,
      assuming elements contains fields 'name' and 'gender'.
      Note: This feature is currently in experimental state and may change in the future!
      Parameters:
      expr - The string based expression to use.
    • getRegexFilter

      public String getRegexFilter()
      Returns the regular expression used to search all the fields.
      If empty, then the regular expression is not used.
      Returns:
      The regular expression used to search all the fields.
    • setRegexFilter

      public void setRegexFilter(String regex)
      Sets the regular expression used to search all the fields.
      Parameters:
      regex - The regular expression to use.
    • getGeometry

      public Geometry getGeometry()
      Returns the geometry used for proximity search.
      Returns:
      The geometry used for proximity search.
    • setGeometry

      public void setGeometry(Geometry geometry)
      Sets the geometry used for proximity search.
      If geometry is set, then projection must be also defined.
      Parameters:
      geometry - The geometry used for proximity search.
    • getProjection

      public Projection getProjection()
      Returns the projection to use for search geometry.
      Returns:
      The projection to use for search geometry.
    • setProjection

      public void setProjection(Projection projection)
      Sets the projection to use for search geometry.
      Parameters:
      projection - The projection to use for search geometry.
    • getSearchRadius

      public float getSearchRadius()
      Returns the search radius for proximity search (in meters). The default is 0.
      Returns:
      The proximity search radius in meters.
    • setSearchRadius

      public void setSearchRadius(float radius)
      Sets the search radius for proximity search (in meters). The default is 0.
      Parameters:
      radius - The proximity search radius in meters.
    • toString

      public String toString()
      Creates a string representation of this request object, useful for logging.
      Overrides:
      toString in class Object
      Returns:
      The string representation of this request object.