Make a customfield searchable

Hi,

I want to make my customfield searchable with the normal version search. I found some tutorials but they didnt work for me. (Modifying the pom.xml to associate the cftype with the searcher. But still after installing my plugin (and later reindexing and restart jira) it was not shown in the issue navigator).

The tutorial I tried:

http://www.j-tricks.com/1/post/2010/09/custom-field-searchers.html

Someone had the same problem and knows a solution ? Or is there another tutorial I missed?

Greets,

Mokuyobi

2 answers

0 votes

After modifying the plugin, did you edit the custom field and apply that searcher?

I can not even select any searcher.

I just found out that it works if I use the TextSearcher. But I want to use the VersionSearcher. If I extend the Version Searcher it doesnt work and the plugin disables itself.

I am using jira 5.0.7 .

Below code will work.

public class CustomVersionSearcher extends VersionSearcher {

public CustomVersionSearcher(VersionManager versionManager,
FieldVisibilityManager fieldVisibilityManager,
JqlOperandResolver operandResolver,
PermissionManager permissionManager, CustomFieldInputHelper customFieldInputHelper) {
super(versionManager, fieldVisibilityManager, new VersionResolver(versionManager), operandResolver,
new DefaultFieldFlagOperandRegistry() , new VersionClauseContextFactory(operandResolver, new VersionResolver(versionManager), permissionManager) ,
permissionManager, ContextSetUtil.getInstance(), ComponentAccessor.getComponent(FieldConfigSchemeClauseContextUtil.class) , new MultiClauseDecoratorContextFactory.Factory( new DefaultOperatorUsageValidator(operandResolver, ComponentAccessor.getI18nHelperFactory()) , operandResolver, ContextSetUtil.getInstance()),
customFieldInputHelper);

}

Has anyone used this and also changed how the indexer stores the data in the lucene index by overriding the init function? I keep getting an error that the variable for the DefaultFieldFlagOperandRegistry is null in this code line. this.searchInputTransformer = new VersionPickerCustomFieldSearchInputTransformer(field, operandResolver, fieldFlagOperandRegistry, versionResolver, customFieldInputHelper); fieldFlagOperandRegistry is null because it is never initialized by using the super call in the constructor. I am not sure how to initialize this value. Any pointers? This is my init function and I use the super constructor listed above.

public void init(CustomField field) { super.init(field); final ToggleVersionCustomFieldIndexer indexer = new ToggleVersionCustomFieldIndexer(fieldVisibilityManager, field); this.searcherInformation = new CustomFieldSearcherInformation(field.getId(), field.getNameKey(), Collections.<FieldIndexer>singletonList(indexer), new AtomicReference<CustomField>(field)); this.searchRenderer = new VersionPickerCustomFieldRenderer(field, projectManager, versionManager, fieldVisibilityManager, velocityRequestContextFactory, applicationProperties, templatingEngine, permissionManager, searcherInformation.getNameKey()); this.searchInputTransformer = new VersionPickerCustomFieldSearchInputTransformer(field, operandResolver, fieldFlagOperandRegistry, versionResolver, customFieldInputHelper); this.customFieldSearcherClauseHandler = new SimpleCustomFieldContextValueGeneratingClauseHandler( new VersionCustomFieldValidator(versionResolver, operandResolver, permissionManager, versionManager, beanFactory), new VersionCustomFieldClauseQueryFactory(field.getId(), versionResolver, operandResolver), new IntersectingClauseContextFactory(contextSetUtil, CollectionBuilder.newBuilder( new CustomFieldClauseContextFactory(field, clauseContextUtil, ContextSetUtil.getInstance()), versionClauseContextFactory).asList()), new VersionClauseValuesGenerator(versionManager, permissionManager, beanFactory), OperatorClasses.EQUALITY_AND_RELATIONAL_WITH_EMPTY, JiraDataTypes.VERSION); }

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,120 views 13 19
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