@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.
|
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 inCopyright © 2003–2015 Atlassian. All rights reserved.