Class AndQuery

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

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

    • _queries

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

    • AndQuery

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

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

    • collector

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

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

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

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