Interface SearchQuery

All Known Implementing Classes:
AbstractSearchQuery, EventSearchQuery, SeriesSearchQuery, ThemeSearchQuery

public interface SearchQuery
Interface for the implementation of search queries.
  • Method Details

    • withTypes

      SearchQuery withTypes(String... types)
      Return documents of the given types.
      Parameters:
      types - the resource types to look up
      Returns:
      the query extended by this criterion
    • getTypes

      String[] getTypes()
      Returns the document types or or an empty array if no types were specified.
      Returns:
      the type
    • withLimit

      SearchQuery withLimit(int limit)
      Sets the number of results that are returned.
      Parameters:
      limit - the number of results
      Returns:
      the search query
    • getLimit

      int getLimit()
      Returns the number of results that are returned, starting at the offset returned by getOffset(). If no limit was specified, this method returns -1.
      Returns:
      the maximum number of results
    • withOffset

      SearchQuery withOffset(int offset)
      Sets the starting offset. Search results will be returned starting at that offset and until the limit is reached, as specified by getLimit().
      Parameters:
      offset - the starting offset
      Returns:
      the search query
    • getOffset

      int getOffset()
      Returns the starting offset within the search result or 0 if no offset was specified.
      Returns:
      the offset
    • withText

      SearchQuery withText(String text)
      Returns documents that contain the given text.
      Parameters:
      text - the text to look up
      Returns:
      the query extended by this criterion
    • withText

      SearchQuery withText(boolean wildcardSearch, String text)
      Returns documents that contain the given text.
      Parameters:
      wildcardSearch - True to perform a (much slower) wildcard search
      text - the text to look up
      Returns:
      the query extended by this criterion
    • withText

      SearchQuery withText(boolean fuzzy, SearchTerms.Quantifier quantifier, String... text)
      Returns documents that contain the given text.

      Depending on the quantifier, either documents are returned that contain at least one of the terms are only documents containing all of the terms.

      Parameters:
      fuzzy - true to perform a fuzzy search
      quantifier - whether all or some of the terms need to be matched
      text - the text to look up
      Returns:
      the query extended by this criterion
    • getTerms

      Returns the search terms or an empty collection if no terms were specified.
      Returns:
      the terms
    • getQueryString

      String getQueryString()
      Returns the search text or null if no text was specified.
      Returns:
      the text
    • isFuzzySearch

      boolean isFuzzySearch()
      Returns true if the current search operation should be performed using fuzzy searching.
      Returns:
      true if fuzzy search should be used
    • withFilter

      SearchQuery withFilter(String filter)
      Returns documents that match the search query and the text filter.
      Parameters:
      filter - the filter text
      Returns:
      the search query
    • getFilter

      String getFilter()
      Returns the filter expression.
      Returns:
      the filter
    • getFields

      String[] getFields()
      Returns the fields that should be returned by the query. If all fields should be returned, the method will return an empty array.
      Returns:
      the names of the fields to return
    • withField

      SearchQuery withField(String field)
      Adds a field that needs to be returned by the query. If no fields are being set, all fields will be returned.
      Parameters:
      field - the field name
      Returns:
      the query
    • withFields

      SearchQuery withFields(String... fields)
      Adds the fields that need to be returned by the query. If no fields are being set, all fields will be returned.
      Parameters:
      fields - the field names
      Returns:
      the query
    • withSortOrder

      SearchQuery withSortOrder(String field, SortCriterion.Order order)
      Sort the result set by the field and the given order. The insertion-order is kept.
      Parameters:
      field - the field name, must not be null
      order - the order direction, must not be null
      Returns:
      the updated search query
    • getSortOrders

      Map<String,SortCriterion.Order> getSortOrders()
      Returns all the known sort orders. The insertion-order is kept.
      Returns:
      a map with all known sort orders
    • getSortOrder

      SortCriterion.Order getSortOrder(String field)
      Returns the sort order of a field. If no sort order has been set for the given field, SortCriterion.Order.None is returned.
      Parameters:
      field - the field name, must not be null
      Returns:
      the sort order