Interface ISearch
- All Known Subinterfaces:
SearchWithToken
- All Known Implementing Classes:
AbstractSearch
,ChangesSearch
,ContentSearch
,DecoratedSearchManager.DecoratedSearch
,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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
ISearch.Builder<SEARCH extends ISearch>
Builder interface to create new search instance with the specified values -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Specifies whether the resultingSearchResults.getNextPageSearch()
will be generated with a token.default Optional<HightlightParams>
Provides indication as well as pre/post tag whether query terms should be highlighted in title and body of a search result.int
getLimit()
@NonNull SearchQuery
getQuery()
default EnumSet<SearchIndex>
IMPORTANT: Use the new getIndices method instead.default String
Returns type of search e.g.getSort()
int
default boolean
ISearch.Builder<? extends ISearch>
default ISearch
withIndices
(List<Index> indices) Deprecated, for removal: This API element is subject to removal in a future version.since 9.0.default ISearch
withLimit
(int limit) Deprecated, for removal: This API element is subject to removal in a future version.since 9.0.default ISearch
withQuery
(SearchQuery query) Deprecated, for removal: This API element is subject to removal in a future version.since 9.0.
-
Field Details
-
ENABLE_LUCENE_QUERY_EXPLAIN
- See Also:
-
-
Method Details
-
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
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
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() -
generatesToken
default boolean generatesToken()Specifies whether the resultingSearchResults.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.
- Returns:
- true if
SearchResults.getNextPageSearch()
should be generated with a token - Since:
- 9.0
-
getSearchIndexes
IMPORTANT: Use the new getIndices method instead. Specifies which indexes should be targeted for this particular search. -
getIndices
- Returns:
- a list of indexes should be targeted
- Since:
- 8.7.0
-
withIndices
Deprecated, for removal: This API element is subject to removal in a future version.since 9.0. UsetoBuilder()
- Parameters:
indices
- the indices to search from- Returns:
- a new
ISearch
containing the new indices - Since:
- 8.7.0
-
withQuery
Deprecated, for removal: This API element is subject to removal in a future version.since 9.0. UsetoBuilder()
- 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
-
withLimit
Deprecated, for removal: This API element is subject to removal in a future version.since 9.0. UsetoBuilder()
- Parameters:
limit
- the limit parameter- Returns:
- a new
ISearch
containing the limit parameter - Since:
- 8.9
-
toBuilder
ISearch.Builder<? extends ISearch> toBuilder()- Returns:
- a builder that's initialised with the values of the current search object
- Since:
- 9.0
-