Class AbstractSearch

java.lang.Object
com.atlassian.confluence.search.v2.AbstractSearch
All Implemented Interfaces:
ISearch
Direct Known Subclasses:
ChangesSearch, ContentSearch, DefaultSearch

public abstract class AbstractSearch extends Object implements ISearch
An abstract representation of a search to be performed. Extend this class to create concrete types of searches. It is recommended to make use of AbstractSearch(AbstractBuilder) when constructing a concrete implementation.

This class provides fields and implementations of getters in ISearch which are relied upon by Confluence's V2 search API.

See Also:
  • Field Details

    • indices

      protected final List<Index> indices
    • query

      protected final SearchQuery query
    • sort

      protected final SearchSort sort
    • startOffset

      protected final int startOffset
    • limit

      protected final int limit
    • generatesToken

      protected final boolean generatesToken
  • Constructor Details

    • AbstractSearch

      @Deprecated(since="9.0", forRemoval=true) protected AbstractSearch(EnumSet<SearchIndex> indexes, @NonNull SearchQuery query, SearchSort sort)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructs an abstract representation of a search to be performed. The maximum number of results returned will be a system provided default.
      Parameters:
      indexes - the non-empty, non-null set of indexes which will be searched
      query - the non-null query to perform on the indexes
      sort - how to order the results of the query
    • AbstractSearch

      @Deprecated(since="9.0", forRemoval=true) protected AbstractSearch(List<Index> indexes, @NonNull SearchQuery query, SearchSort sort, int startOffset, int limit)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructs an abstract representation of a search to be performed.
      Parameters:
      indexes - the indexes which will be searched, non-empty.
      query - the query to perform on the indexes non-null.
      sort - how to order the results of the query
      startOffset - the zero-based offset of the first result to return
      limit - the maximum number of results to return
    • AbstractSearch

      protected AbstractSearch(AbstractSearch.AbstractBuilder<?> builder)
      Constructs an abstract representation of a search to be performed.
      Parameters:
      builder -
      Since:
      9.0
  • Method Details

    • getQuery

      public @NonNull SearchQuery getQuery()
      Gets the query component of the search
      Specified by:
      getQuery in interface ISearch
      Returns:
      the non-null search query
    • getSort

      public SearchSort getSort()
      Gets the sort component of the search
      Specified by:
      getSort in interface ISearch
      Returns:
      the search sort
    • getStartOffset

      public int getStartOffset()
      Specified by:
      getStartOffset in interface ISearch
      Returns:
      the start offset (0 based).
    • getLimit

      public int getLimit()
      Specified by:
      getLimit in interface ISearch
      Returns:
      the maximum page size (positive).
    • getSearchIndexes

      public EnumSet<SearchIndex> getSearchIndexes()
      Description copied from interface: ISearch
      IMPORTANT: Use the new getIndices method instead. Specifies which indexes should be targeted for this particular search.
      Specified by:
      getSearchIndexes in interface ISearch
    • getIndices

      public List<Index> getIndices()
      Specified by:
      getIndices in interface ISearch
      Returns:
      a list of indexes should be targeted
    • generatesToken

      public boolean generatesToken()
      Description copied from interface: ISearch
      Specifies whether the resulting SearchResults.getNextPageSearch() will be generated with a token. A search token allows additional searching to be performed against a specific version of the index.

      Note: for backward compatibility reason, this value only applies to OpenSearch where it's especially costly to generate a token for every search request. On Lucene, this value is currently ignored, i.e. it will continue to generate a token for every search request. This may change in the future, so if you require a token, you should make this return true.

      Specified by:
      generatesToken in interface ISearch
      Returns:
      true if SearchResults.getNextPageSearch() should be generated with a token
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object