简体   繁体   中英

How to use SearchCount method of Search Service Interface of atlassian 6.2.1?

I am developing application related to jira. I want count of issues return by the jql query. i got searchCount method in this link but i am not getting how to use this method using instance.

The setup should look like this:

    String jqlQuery = "project=ABC"; // insert your JQL query here

    SearchService.ParseResult parseResult = searchService.parseQuery(currentUser, jqlQuery);

    if (!parseResult.isValid())
    {
        // errors in parseResult.getErrors().getErrorMessages()
        throw new MyException();
    }

    com.atlassian.query.Query query = parseResult.getQuery();

    com.atlassian.jira.util.MessageSet validateResults = searchService.validateQuery(currentUser, query);

    if (validateResults.hasAnyErrors())
    {
        // errors in validateResults.getErrorMessages()
        throw new MyException();
    }

With the resulting validated query object, you can then call searchService.searchCount(currentUser, query) to get your issue count.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM