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 vote

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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

25 views 0 4
Read article

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