Interface CQLSearchService
- Since:
- 5.7
-
Method Summary
Modifier and TypeMethodDescriptionint
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.search
(String cqlInput, SearchOptions searchOptions, PageRequest pageRequest, Expansion... expansions) Execute a CQL search query and fetch a page of results.searchContent
(String cqlInput, Expansion... expansions) Execute a CQL search query and fetch a page results.searchContent
(String cqlInput, PageRequest pageRequest, Expansion... expansions) Execute a CQL search query and fetch a page results.searchContent
(String cqlInput, SearchContext searchContext, PageRequest pageRequest, Expansion... expansions) Execute a CQL search query and fetch a page results.
-
Method Details
-
searchContent
PageResponse<Content> searchContent(String cqlInput, SearchContext searchContext, PageRequest pageRequest, Expansion... expansions) Execute a CQL search query and fetch a page results.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.
- Parameters:
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 result
-
searchContent
PageResponse<Content> searchContent(String cqlInput, PageRequest pageRequest, Expansion... expansions) Execute a CQL search query and fetch a page results.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.
- Parameters:
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 result
-
searchContent
Execute a CQL search query and fetch a page results.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.
- Parameters:
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 accessible
-
countContent
Execute a CQL search query and fetch the number of results found.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");
- Parameters:
cqlInput
- - the cql query to count the results of- Returns:
- a count of the results that match the cql query
-
countContent
Execute a CQL search query and fetch the number of results found.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());
- Parameters:
cqlInput
- - the cql query to count the results ofsearchContext
- - the context to execute the search in- Returns:
- a count of the results that match the cql query
-
search
@Internal SearchPageResponse<SearchResult> search(String cqlInput, SearchOptions searchOptions, PageRequest pageRequest, Expansion... expansions) Execute a CQL search query and fetch a page of results.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"
- Parameters:
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.- Returns:
- a page of
SearchResult
s - Since:
- 5.9
-