Interface ISearch
-
- All Known Subinterfaces:
SearchWithToken
- All Known Implementing Classes:
AbstractSearch
,ChangesSearch
,ContentSearch
,CustomSearch
,DefaultSearch
,DefaultSearchWithToken
public interface ISearch
A representation of a search to be performed. Searches are immutable, and consist of these parts:- The SearchIndex(s) to perform the search on.
- The SearchQuery to be performed.
- The SearchSort describing the order to apply to the results.
- The zero-based startOffset of the results of the search.
- The limit or maximum number of results to return.
- isExplain indicating whether or not to provide explanation for the query.
- The HighlightParams describing how to highlight the search.
Implementations of this interface will provide fields which are relied upon by Confluence's V2 search API.
It is recommended to extend
AbstractSearch
when providing a concrete implementation of this interface.- See Also:
SearchIndexAccessor
,SearchManager
,AbstractSearch
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Optional<HightlightParams>
getHighlight()
Provides indication as well as pre/post tag whether query terms should be highlighted in title and body of a search result.default List<Index>
getIndices()
int
getLimit()
@NonNull SearchQuery
getQuery()
default List<String>
getSearchAfter()
This method is only relevant to OpenSearch.default EnumSet<SearchIndex>
getSearchIndexes()
IMPORTANT: Use the new getIndices method instead.default String
getSearchType()
Returns type of search e.g.SearchSort
getSort()
int
getStartOffset()
default boolean
isExplain()
default ISearch
withIndices(List<Index> indices)
This method is only applicable forCustomSearch
andDefaultSearch
A class must implement this method.default ISearch
withQuery(SearchQuery query)
A class must implement this method.default ISearch
withSearchAfter(List<String> searchAfter)
This method is only relevant to OpenSearch.
-
-
-
Method Detail
-
getQuery
@NonNull SearchQuery getQuery()
- Returns:
- the non-null query component of the search
-
getSort
SearchSort getSort()
- Returns:
- the sort component of the search
-
getStartOffset
int getStartOffset()
- Returns:
- the start offset (0 based).
-
getLimit
int getLimit()
- Returns:
- the maximum page size (positive).
-
getSearchType
default String getSearchType()
Returns type of search e.g. SiteSearch, RecentUpdate, NetworkFeed, BlogUpdate, which can be used by search manager to switch between different implementations to support incremental roll out.- Returns:
- type of search
-
getHighlight
default Optional<HightlightParams> getHighlight()
Provides indication as well as pre/post tag whether query terms should be highlighted in title and body of a search result. SeeSearchResult.getDisplayTitleWithHighlights()
andSearchResult.getResultExcerptWithHighlights()
.
-
isExplain
default boolean isExplain()
-
getSearchIndexes
default EnumSet<SearchIndex> getSearchIndexes()
IMPORTANT: Use the new getIndices method instead. Specifies which indexes should be targeted for this particular search.
-
getIndices
default List<Index> getIndices()
- Returns:
- a list of indexes should be targeted
- Since:
- 8.7.0
-
getSearchAfter
default List<String> getSearchAfter()
This method is only relevant to OpenSearch. It does not have any effect if querying against Lucene.- Returns:
- a list of sorted field values
- Since:
- 8.7.0
-
withSearchAfter
default ISearch withSearchAfter(List<String> searchAfter)
This method is only relevant to OpenSearch. A class must implement this method. Otherwise, it will have no effect on the search results.- Parameters:
searchAfter
- the searchAfter parameter- Returns:
- a new
ISearch
containing the searchAfter parameter - Since:
- 8.7.0
-
withIndices
default ISearch withIndices(List<Index> indices)
This method is only applicable forCustomSearch
andDefaultSearch
A class must implement this method. Otherwise, it will have no effect on the search results.- Parameters:
indices
- the indices to search from- Returns:
- a new
ISearch
containing the new indices - Since:
- 8.7.0
-
withQuery
default ISearch withQuery(SearchQuery query)
A class must implement this method. Otherwise, UnsupportedOperationException will be thrown.- Parameters:
query
- the query to be added to the search object- Returns:
- a new
ISearch
containing the new query - Throws:
UnsupportedOperationException
- if the class does not implement this method- Since:
- 8.7.0
-
-