public class SearchResource extends Object
Constructor and Description |
---|
SearchResource(SearchService searchService,
JiraAuthenticationContext jiraAuthenticationContext,
IssueSearchLimits searchLimits,
BeanBuilderFactory beanBuilderFactory,
MauEventService mauEventService) |
Modifier and Type | Method and Description |
---|---|
protected SearchResultsBean |
asResultsBean(SearchResults results,
PagerFilter filter,
IncludedFields fields,
StringList expand,
Set<String> warningMessages)
Creates a SearchResultsBean suitable for returning to the client.
|
protected PagerFilter |
createFilter(Integer startAt,
Integer maxResults)
Creates a new PagerFilter for the given search request.
|
SearchResultsBean |
search(String jql,
Integer startAt,
Integer maxResults,
Boolean validateQuery,
List<StringList> fields,
StringList expand)
Searches for issues using JQL.
|
SearchResultsBean |
searchUsingSearchRequest(SearchRequestBean searchRequest)
Performs a search using JQL.
|
public SearchResource(SearchService searchService, JiraAuthenticationContext jiraAuthenticationContext, IssueSearchLimits searchLimits, BeanBuilderFactory beanBuilderFactory, MauEventService mauEventService)
public SearchResultsBean search(String jql, Integer startAt, Integer maxResults, Boolean validateQuery, List<StringList> fields, StringList expand) throws SearchException
Sorting
the jql
parameter is a full JQL
expression, and includes an ORDER BY
clause.
The fields
param (which can be specified multiple times) gives a comma-separated list of fields
to include in the response. This can be used to retrieve a subset of fields.
A particular field can be excluded by prefixing it with a minus.
By default, only navigable (*navigable
) fields are returned in this search resource. Note: the default is different
in the get-issue resource -- the default there all fields (*all
).
*all
- include all fields*navigable
- include just navigable fieldssummary,comment
- include just the summary and comments-description
- include navigable fields except the description (the default is *navigable
for search)*all,-comment
- include everything except comments
GET vs POST: If the JQL query is too large to be encoded as a query param you should instead POST to this resource.
Expanding Issues in the Search Result: It is possible to expand the issues returned by directly specifying the expansion on the expand parameter passed in to this resources.
For instance, to expand the "changelog" for all the issues on the search result, it is neccesary to specify "changelog" as one of the values to expand.
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.SearchException
- if there is a problem performing the searchpublic SearchResultsBean searchUsingSearchRequest(SearchRequestBean searchRequest) throws SearchException
searchRequest
- a JSON object containing the search requestSearchException
- if there is a problem performing the searchprotected SearchResultsBean asResultsBean(SearchResults results, PagerFilter filter, IncludedFields fields, StringList expand, Set<String> warningMessages)
results
- a SearchResultsfilter
- a PagerFilter that was used for the searchfields
- a List<StringList,>expand
- the parameters to expandwarningMessages
- protected PagerFilter createFilter(Integer startAt, Integer maxResults)
IssueSearchLimits.getMaxResults()
,
the value returned by this method will be used.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 insteadCopyright © 2002-2017 Atlassian. All Rights Reserved.