@ExperimentalApi
public interface CQLSearchService
Modifier and Type | Method and Description |
---|---|
int |
countContent(String cqlInput)
Execute a CQL search query and fetch the number of results found.
|
int |
countContent(String cqlInput,
SearchContext searchContext)
Execute a CQL search query and fetch the number of results found.
|
SearchPageResponse<SearchResult> |
search(String cqlInput,
SearchOptions searchOptions,
PageRequest pageRequest,
Expansion... expansions)
Execute a CQL search query and fetch a page of results.
|
PageResponse<Content> |
searchContent(String cqlInput,
Expansion... expansions)
Execute a CQL search query and fetch a page results.
|
PageResponse<Content> |
searchContent(String cqlInput,
PageRequest pageRequest,
Expansion... expansions)
Execute a CQL search query and fetch a page results.
|
PageResponse<Content> |
searchContent(String cqlInput,
SearchContext searchContext,
PageRequest pageRequest,
Expansion... expansions)
Execute a CQL search query and fetch a page results.
|
PageResponse<Content> searchContent(String cqlInput, SearchContext searchContext, PageRequest pageRequest, Expansion... expansions)
For example, to fetch the first 10 pieces of content in the DEV space with a title containing 'Specs' :
cqlSearchService.searchContent("space = DEV AND title ~ 'Specs' ORDER BY title", SearchContext.builder().build(), new SimplePageRequest(0, 10));
The service will verify the execution context, confirming that the passed entity ids exist, throwing NotFoundException if they don't exist.
cqlInput
- - the CQL query to executesearchContext
- - the context to execute the search inpageRequest
- - the pagination request, indicating the start position and limit for the resultexpansions
- - the optional properties to expand on the resultPageResponse<Content> searchContent(String cqlInput, PageRequest pageRequest, Expansion... expansions)
For example, to fetch the first 10 pieces of content in the DEV space with a title containing 'Specs' :
cqlSearchService.searchContent("space = DEV AND title ~ 'Specs' ORDER BY title", new SimplePageRequest(0, 10));
This variant of the method executes with the default search context of just the logged in user.
cqlInput
- - the CQL query to executepageRequest
- - the pagination request, indicating the start position and limit for the resultexpansions
- - the optional properties to expand on the resultPageResponse<Content> searchContent(String cqlInput, Expansion... expansions)
For example, to fetch the first page of content in the DEV space with a title containing 'Specs' :
cqlSearchService.searchContent("space = DEV AND title ~ 'Specs' ORDER BY title", ExpansionParser.parse("space, history"));
This variant executes with the default execution context and a default page size.
cqlInput
- - the CQL query to executeexpansions
- - optional properties to expand on the result, if an expandable property is not specified here
that property will not be accessibleint countContent(String cqlInput)
For example to count the number of pages and blogs in the DEV space created by admin :
cqlSearchService.countContent("type in (page, blogpost) and space = DEV and creator = admin");
cqlInput
- - the cql query to count the results ofint countContent(String cqlInput, SearchContext searchContext)
For example to count the number of pages and blogs in the DEV space created by admin :
cqlSearchService.countContent("type in (page, blogpost) and space = DEV and creator = admin", SearchContext.builder().build());
cqlInput
- - the cql query to count the results ofsearchContext
- - the context to execute the search in@Internal SearchPageResponse<SearchResult> search(String cqlInput, SearchOptions searchOptions, PageRequest pageRequest, Expansion... expansions)
The result set includes all searchable entities in confluence, including users, spaces, content and plugin content, such as Confluence Questions.
Expansions are applied to the entity in the search result that matches the entity type. For instance to expand the version property on a piece of content, pass the expansion property: "content.version", likewise to expand the homepage of a space, use the expansion string : "space.homepage"
cqlInput
- - the query to searchsearchOptions
- - search options to apply when executing the querypageRequest
- - the pagination request, indicating the start position and limit for the resultexpansions
- - the expansions to apply to the result.SearchResult
sCopyright © 2003–2017 Atlassian. All rights reserved.