Class SearchResource
java.lang.Object
com.atlassian.jira.rest.v2.search.SearchResource
@Path("search")
@Consumes("application/json")
@Produces("application/json")
public class SearchResource
extends Object
Resource for searches.
- Since:
- v4.3
-
Constructor Summary
ConstructorsConstructorDescriptionSearchResource(SearchService searchService, JiraAuthenticationContext jiraAuthenticationContext, IssueSearchLimits searchLimits, BeanBuilderFactory beanBuilderFactory, MauEventService mauEventService, com.atlassian.plugins.rest.api.internal.expand.resolver.SelfExpandingEntityExpanderResolver selfExpandingEntityExpanderResolver, com.atlassian.plugins.rest.api.expand.EntityCrawler entityCrawler) -
Method Summary
Modifier and TypeMethodDescriptionprotected SearchResultsBeanasResultsBean(SearchResults<Issue> results, PagerFilter filter, IncludedFields fields, StringList expand, Set<String> warningMessages) Creates a SearchResultsBean suitable for returning to the client.protected PagerFiltercreateFilter(Integer startAt, Integer maxResults) Creates a new PagerFilter for the given search request.search(String jql, Integer startAt, Integer maxResults, Boolean validateQuery, List<StringList> fields, StringList expand) Searches for issues using JQL.searchUsingSearchRequest(SearchRequestBean searchRequest) Performs a search using JQL.
-
Constructor Details
-
SearchResource
@Inject public SearchResource(SearchService searchService, JiraAuthenticationContext jiraAuthenticationContext, IssueSearchLimits searchLimits, BeanBuilderFactory beanBuilderFactory, MauEventService mauEventService, com.atlassian.plugins.rest.api.internal.expand.resolver.SelfExpandingEntityExpanderResolver selfExpandingEntityExpanderResolver, com.atlassian.plugins.rest.api.expand.EntityCrawler entityCrawler)
-
-
Method Details
-
search
@GET public SearchResultsBean search(@QueryParam("jql") String jql, @QueryParam("startAt") Integer startAt, @QueryParam("maxResults") Integer maxResults, @QueryParam("validateQuery") @DefaultValue("true") Boolean validateQuery, @QueryParam("fields") List<StringList> fields, @QueryParam("expand") StringList expand) throws SearchException Searches for issues using JQL.- Parameters:
jql- a JQL query stringstartAt- the index of the first issue to return (0-based)maxResults- the maximum number of issues to return (defaults to 50). The maximum allowable value is dictated by the Jira property 'jira.search.views.default.max'. If you specify a value that is higher than this number, your search results will be truncated.validateQuery- whether to validate the JQL queryfields- the list of fields to return for each issue. By default, all navigable fields are returned.expand- A comma-separated list of the parameters to expand.- Returns:
- a SearchResultsBean
- Throws:
SearchException- if there is a problem performing the search
-
searchUsingSearchRequest
@POST public SearchResultsBean searchUsingSearchRequest(SearchRequestBean searchRequest) throws SearchException Performs a search using JQL.- Parameters:
searchRequest- a JSON object containing the search request- Returns:
- a SearchResultsBean
- Throws:
SearchException- if there is a problem performing the search
-
asResultsBean
protected SearchResultsBean asResultsBean(SearchResults<Issue> results, PagerFilter filter, IncludedFields fields, StringList expand, Set<String> warningMessages) Creates a SearchResultsBean suitable for returning to the client.- Parameters:
results- a SearchResultsfilter- a PagerFilter that was used for the searchfields- a List<StringList,>expand- the parameters to expandwarningMessages-- Returns:
- a SearchResultsBean
-
createFilter
Creates a new PagerFilter for the given search request. If the intendedMaxResultsToReturn specified in the search request is greater than the value returned byIssueSearchLimits.getMaxResults(), the value returned by this method will be used.- Parameters:
startAt- an Integer containing the start indexmaxResults- an Integer containing the intended maximum number of search results to be returned. However, this is limited by the value of the property jira.search.views.default.max and if intendedMaxResultsToReturn is greater than that value limit, the maximum number of results returned will be set using the property value instead- Returns:
- a PagerFilter
-