Interface Query

All Superinterfaces:
SolrDataQuery
All Known Subinterfaces:
FacetAndHighlightQuery, FacetQuery, HighlightQuery
All Known Implementing Classes:
AbstractFacetAndHighlightQueryDecorator, AbstractFacetQueryDecorator, AbstractHighlightQueryDecorator, AbstractQueryDecorator, SimpleFacetAndHighlightQuery, SimpleFacetQuery, SimpleHighlightQuery, SimpleQuery

public interface Query extends SolrDataQuery
A Query that can be translated into a solr understandable Query.
  • Field Details

  • Method Details

    • addProjectionOnField

      <T extends Query> T addProjectionOnField(Field field)
      add given Field to those included in result. Corresponds to the fl parameter in solr.
      Parameters:
      field -
      Returns:
    • projectAllFields

      default <T extends Query> T projectAllFields()
      Shortcut for addProjectionOnField(Field.of("*")) to project all known fields.
      Type Parameters:
      T -
      Returns:
      this
      Since:
      4.1
    • setPageRequest

      <T extends Query> T setPageRequest(org.springframework.data.domain.Pageable pageable)
      restrict result to entries on given page. Corresponds to the start and row parameter in solr
      Parameters:
      pageable -
      Returns:
    • setOffset

      <T extends Query> T setOffset(Long offset)
      Set the number of rows to skip.
      Parameters:
      offset -
      Returns:
      Since:
      1.3
    • setRows

      <T extends Query> T setRows(Integer rows)
      Set the number of rows to fetch.
      Parameters:
      rows -
      Returns:
      Since:
      1.3
    • addGroupByField

      <T extends Query> T addGroupByField(Field field)
      add the given field to those used for grouping result Corresponds to '' in solr
      Parameters:
      field -
      Returns:
    • addFilterQuery

      <T extends Query> T addFilterQuery(FilterQuery query)
      add query to filter results Corresponds to fq in solr
      Parameters:
      query -
      Returns:
    • setTimeAllowed

      <T extends Query> T setTimeAllowed(Integer timeAllowed)
      The time in milliseconds allowed for a search to finish. Values <= 0 mean no time restriction.
      Parameters:
      timeAllowed -
      Returns:
    • getFilterQueries

      List<FilterQuery> getFilterQueries()
      Get filter queries if defined
      Returns:
    • getPageRequest

      @Deprecated org.springframework.data.domain.Pageable getPageRequest()
      Deprecated.
      since 1.3. Will be removed in 1.4. Please use getOffset() and getRows() instead.
      Get page settings if defined.
      Returns:
    • getOffset

      @Nullable Long getOffset()
      Get number of rows to skip.
      Since:
      1.3
    • getRows

      @Nullable Integer getRows()
      Get number of rows to fetch.
      Returns:
      Since:
      1.3
    • getGroupByFields

      List<Field> getGroupByFields()
      Get group by fields if defined
      Returns:
    • getProjectionOnFields

      List<Field> getProjectionOnFields()
      Get projection fields if defined
      Returns:
    • addSort

      <T extends Query> T addSort(org.springframework.data.domain.Sort sort)
      Add Sort to query
      Parameters:
      sort -
      Returns:
    • getSort

      @Nullable org.springframework.data.domain.Sort getSort()
      Returns:
      null if not set
    • getTimeAllowed

      @Nullable Integer getTimeAllowed()
      Return the time (in milliseconds) allowed for a search to finish
      Returns:
    • setDefaultOperator

      void setDefaultOperator(Query.Operator operator)
      Set the default operator q.op for query expressions
    • getDefaultOperator

      @Nullable Query.Operator getDefaultOperator()
      Get the specified default operator for query expressions, overriding the default operator specified in the schema.xml file.
      Returns:
    • getDefType

      @Nullable String getDefType()
      Get the default type of query, if one has been specified. Overrides the default type specified in the solrconfig.xml file.
      Returns:
    • setDefType

      void setDefType(String defType)
      Sets the default type to be used by the query.
    • getRequestHandler

      @Nullable String getRequestHandler()
      Returns the request handler.
    • setRequestHandler

      void setRequestHandler(String requestHandler)
      Sets the request handler.
    • setGroupOptions

      <T extends Query> T setGroupOptions(GroupOptions groupOptions)
      Sets GroupOptions for this Query.
      Parameters:
      groupOptions -
      Returns:
    • getGroupOptions

      @Nullable GroupOptions getGroupOptions()
      Returns:
      group options
    • setStatsOptions

      <T extends Query> T setStatsOptions(StatsOptions statsOptions)
      Set StatsOptions for this Query.
      Parameters:
      statsOptions -
      Returns:
      Since:
      1.4
    • getStatsOptions

      @Nullable StatsOptions getStatsOptions()
      Returns:
      StatsOptions or null if not set.
      Since:
      1.4
    • setSpellcheckOptions

      <T extends Query> T setSpellcheckOptions(SpellcheckOptions spellcheckOptions)
      Set the SpellcheckOptions to enable spellchecking.
      Parameters:
      spellcheckOptions - can be null.
      Returns:
      never null.
      Since:
      2.1
    • getSpellcheckOptions

      @Nullable SpellcheckOptions getSpellcheckOptions()
      Returns:
      null if not set.
      Since:
      2.1
    • all

      static Query all()
      Create a new Query matching all documents.
      Returns:
      new instance of Query.
      Since:
      4.1
    • query

      static Query query(Criteria criteria)
      Create a new Query for the given Criteria.
      Parameters:
      criteria - must not be null.
      Returns:
      new instance of Query.
      Since:
      4.1
    • query

      static Query query(String queryString)
      Create a new Query form the given queryString.
      Parameters:
      queryString - must not be null.
      Returns:
      new instance of Query.
      Since:
      4.1