Class OrQuery

java.lang.Object
org.ametys.cms.search.query.OrQuery
All Implemented Interfaces:
Query
Direct Known Subclasses:
MaxScoreOrQuery

public class OrQuery extends Object implements Query
Represents a search Query corresponding to the logical "or" between several other queries.
  • Field Details

    • _queries

      protected List<Query> _queries
      The list of queries. The queries on this list are distinct.
  • Constructor Details

    • OrQuery

      public OrQuery(Query... queries)
      Build an OrQuery object.
      Parameters:
      queries - the queries.
    • OrQuery

      public OrQuery(Collection<Query> queries)
      Build an OrQuery object.
      Parameters:
      queries - the queries as a Collection.
  • Method Details

    • collector

      public static Collector<Query,?,OrQuery> collector()
      Returns a Collector which collects Queries into an OR query
      Returns:
      a Collector which collects Queries into an OR query
    • getQueries

      public List<Query> getQueries()
      Get the list of queries in this "or".
      Returns:
      the list of queries.
    • 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.
    • buildAsJson

      Description copied from interface: Query
      Build the solr query representing the Query object.
      The return type may be either String or Map<String, Object> following the Solr JSON Query DSL.
      Specified by:
      buildAsJson in interface Query
      Returns:
      the solr query representing the Query object.
      Throws:
      QuerySyntaxException - if the query can't be built because of a syntax error.
    • rewrite

      public Query rewrite()
      Description copied from interface: Query
      Rewrite this Query to allow further optimisations.
      Specified by:
      rewrite in interface Query
      Returns:
      a rewritten Query, sementically identical
    • toString

      public String toString(int indent)
      Description copied from interface: Query
      Gets a representation of this Query, for pretty-printing for logging and debugging purposes
      Specified by:
      toString in interface Query
      Parameters:
      indent - The current indentation. Base indentation is 2 (for printing a sub-level)
      Returns:
      a representation of this Query
    • _tagNameForToString

      The tag name for toString(int) debug method.
      Returns:
      The tag name for toString(int) debug method.
    • hashCode

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

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