Make a customfield searchable

Mokuyobi March 27, 2013

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
vijaya reddy June 30, 2013

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);

}

Dale Miller June 11, 2015

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.

Dale Miller June 11, 2015

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); }

0 votes
Jobin Kuruvilla [Adaptavist]
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.
March 27, 2013

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

Mokuyobi April 1, 2013

I can not even select any searcher.

Mokuyobi April 1, 2013

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.

Suggest an answer

Log in or Sign up to answer