Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Basic text searcher not showing up?

margol July 15, 2012

I have a plugin with the following atlassian-plugin.xml

<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
  <plugin-info>
    <description>${project.description}</description>
    <version>${project.version}</version>
    <vendor name="${project.organization.name}" url="${project.organization.url}"/>
  </plugin-info>
  <resource type="i18n" name="i18n" location="net.beamartyr.atlassian.issue-cf"/>
  <customfield-type name="Issue CustomField" i18n-name-key="issue-cf.name" key="issue-cf" 
    class="net.beamartyr.atlassian.jira.customfields.IssueCF">
    <description key="issue-cf.description">A custom field that stores a single link to an issue</description>
    <resource name="view" type="velocity" location="/templates/customfields/issue-cf/view.vm"/>
    <resource name="edit" type="velocity" location="/templates/customfields/issue-cf/edit.vm"/>
  </customfield-type>
  <customfield-searcher name="Issue Searcher" i18n-name-key="issue-cf-searcher.name" key="issue-cf-searcher" 
    class="com.atlassian.jira.issue.customfields.searchers.TextSearcher">
    <description key="issue-cf-searcher.description">Search for an issue by id</description>
    <valid-customfield-type package="${project.groupId}.${project.artifactId}" key="issue-cf"/>
    <resource type="velocity" name="search" location="templates/plugins/fields/edit-searcher/search-basictext.vm"/>
  </customfield-searcher>
</atlassian-plugin>

The issue type works fine, but when setting it up, I get the message "There are no search templates for this custom field type."

Nothing shows up in the log at default logging levels...

I'm wondering what, if anything, I've defined wrong to use the default built-in text searcher with my custom field?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
LukasG June 1, 2015

This is actually working as expected and the correct answer if you just want to use a system searcher such as ExactTextSearcher or NumberRangeSearcher can be found here: https://answers.atlassian.com/questions/16394860

Still the solution provided here works. But it is not necessary and not recommended when you use a system searcher.

3 votes
Radek Kantor
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.
July 15, 2012

Hi,

if you create own CF and want use searcher for this field, you must create separate searcher class (eg. by extend basic JIRA TextSearcher) in your plugin. I dont known why, but using directly JIRA searcher classes dont work.

Hopes, this help.

Radek Kantor
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.
July 15, 2012

Example:

<customfield-searcher key="cf-url-searcher" name="URL Link CF Searcher"
		i18n-name-key="cf.url.searcher.name" class="com.jira.plugin.ea.URLLinkCFSearcher">
		<description key="cf.url.searcher.desc">Allows searching for an URL Link by specifying attachment name.</description>
		<resource type="velocity" name="search"
			location="/template/plugin/cf/search/urlsearch.vm" />
		<resource type="velocity" name="view"
			location="/template/plugin/cf/search/urlview.vm" />
		<valid-customfield-type package="com.jira.plugin.ea"
			key="cf-url" />
	</customfield-searcher>

Plugin searcher class:

import com.atlassian.jira.issue.customfields.searchers.TextSearcher;
import com.atlassian.jira.issue.customfields.searchers.transformer.CustomFieldInputHelper;
import com.atlassian.jira.jql.operand.JqlOperandResolver;
import com.atlassian.jira.web.FieldVisibilityManager;

public class URLLinkCFSearcher extends TextSearcher {

	public URLLinkCFSearcher(FieldVisibilityManager fieldVisibilityManager,
			JqlOperandResolver jqlOperandResolver,
			CustomFieldInputHelper customFieldInputHelper) {
		super(fieldVisibilityManager, jqlOperandResolver, customFieldInputHelper);
	} 

}

David Welsh October 27, 2012

This helped solve my issue, however in order for it to work, I had to change:

<valid-customfield-type package="com.jira.plugin.ea" ... />
To:
<valid-customfield-type package="${project.groupId}.${project.artifactId}" ... />
As for whatever reason the package in this tag isn't the package that your custom field is in, but rather the package of the whole JIRA Plugin.
Like Mateusz Korczyński likes this
tommy guo
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.
June 30, 2013

I'm sorry if this is a dumb question but does the class definition go into the .vm file or do you create a seperate .java file for it?

Terry Jeske July 7, 2014

@David Welsh

Thank you for posting this, I have been banging my head against the wall for days trying to get my searcher registered, and adding the proj.groupid and artificate finally made it work.

2 votes
Daniel Tsosie May 23, 2013

They should definitely update the documentation at https://developer.atlassian.com/display/JIRADEV/How+to+create+a+new+Custom+Field+Type

because it gives the definite impression you don't need to extend the searcher.

TAGS
AUG Leaders

Atlassian Community Events