Custom field search


I'm developing custom field. I need to get all saved values for that field.

It could be direct SQL request or using some service - it doesn't matter.

Is there is some possibility?

Thanks in advance.

1 answer

I found, that LabelManager do it via

new SearchRequest().getQuery(), 
new PrefixFieldableHitCollector(issueIndexManager.getIssueSearcher(), field, token, suggestions), 

But when I'm trying to do the same, I got empty result :(

My custom field is based on TextCFType and uses com.atlassian.jira.issue.customfields.searchers.TextSearcher. Jira allows to search via this field and return correct results. But when I'm trying to do it programmatically - it doesn't.

I tryed to use com.atlassian.query.Query as first parameter to search function but it also failed.

Here's code that I'm currently debugging:

Set<String> getSuggestions(final User user, final String field, final String query){
      suggestions = new TreeSet<String>();

      final Query filterQuery = new PrefixQuery(new Term(field, query));
      final JqlQueryBuilder jqlQueryBuilder = JqlQueryBuilder.newBuilder();
            new PrefixFieldableHitCollector(
      catch (SearchException e)
        throw new RuntimeException(e);

    return suggestions;

Any help is appreciated.

Suggest an answer

Log in or Join to answer
Community showcase
Louis De Jaeger
Posted yesterday in Off-topic

Friday fun: your best joke

Hi all Lets make this Friday fun really fun and post one (or more) of your best jokes! The joke can be about an Atlassian product, or just a really fun joke you want to share! I’m not the best j...

34 views 1 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot