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 Details

  • 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 string
      startAt - 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 query
      fields - 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 SearchResults
      filter - a PagerFilter that was used for the search
      fields - a List<StringList,>
      expand - the parameters to expand
      warningMessages -
      Returns:
      a SearchResultsBean
    • createFilter

      protected PagerFilter createFilter(Integer startAt, Integer maxResults)
      Creates a new PagerFilter for the given search request. If the intendedMaxResultsToReturn specified in the search request is greater than the value returned by IssueSearchLimits.getMaxResults(), the value returned by this method will be used.
      Parameters:
      startAt - an Integer containing the start index
      maxResults - 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