how to avoid two time search?

chintu Parameshwar February 19, 2013

Hi,

I wrote a JQL function (for "issue in myFunction_getIssues()"), inside overriden getValues method

1. wrote sql-jdbc statements to get issueids.(Say I got 50k issue ids). If I return these ids as queryliteral list, I got an error saying, I donot have access to few issue ids. So

2. I tried to filter this id list by passing them to SearchService.search method (Say I got 40K issues/ids)

3. Now I returned this 40k issue ids as queryliteral list from getValues method.

So far it is fine, but please observe that I already performed a search in 2nd step. And the one more search is happend with the returned list in Issue Navigator. Which results in double the time of search.

Could you anybody help me out and suggest me to avoid any one of the searchs to improve the performance?

Thanks a billion in advance!

1 answer

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2013

You could use hasPermission(browse) for each of the issue IDs. But it's going to be very slow... what's the performance like returning 40k literals? I found it incredibly slow.

You can use a custom field and write your own search, and return Lucene terms which is much faster - that's what I did for the script runner plugin. You might want to try that... https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+JQL+Functions#ScriptedJQLFunctions-Writingyourownfunctions

NB - the point about returning query terms and not literal IDs, is that when the lucene search is done it's combined with a filter that only allows selecting what the current user has visibility of - which is much faster than checking the permissions for each issue individually.

chintu Parameshwar February 19, 2013

It is taking around 2 minutes to return 40k literals.

Could you please eloberate returning Lucene terms? Can I find these in your groovy source? Any refs please?

Thank you very much in advance!

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2013

That bit of the plugin is not open source atm. Try to find a plugin for a custom field that ships with its own searcher...

chintu Parameshwar February 19, 2013

Thank you very much!

chintu Parameshwar February 20, 2013

Hi,

I'm trying to create a custom field type using sdk. I have added a custom field module successfully.

but now I don't no which searcher module is suitable to this kind of usage. Here are the types:

1: AbstractInitializationCustomFieldSearcher

2: DateRangeSearcher

3: ExactNumberSearcher

4: ExactTextSearcher

5: NumberRangeSearcher

6: TextSearcher

7: UserPickerSearcher

8: VersionSearcher

9: Custom Searcher Class

Thanks for your help!

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2013

You need to write your own... you might want to ask a new question.

Suggest an answer

Log in or Sign up to answer