Hi, I am creating my own custom type of digital field, the problem is that my type does not work in search
Field ‘cf[24001]’ is not searchable, it is only sortable.
<customfield-searcher key="exactnumbertest" name="Number Searcher test" class="com.mycompany.plugins.view.CustomFieldSearch">
<description key="admin.customfield.searcher.exactnumber.desctest">Allow searching for a number which exactly matches.</description>
<resource type="velocity" name="search" location="/templates/com/mycompany/plugins/search.vm"/>
<resource type="velocity" name="view" location="/templates/com/mycompany/plugins/view-searcher.vm"/>
<valid-customfield-type package="com.atlassian.jira.plugin.system.customfieldtypes" key="float"/>
<valid-customfield-type package="com.atlassian.jira.plugin.system.customfieldtypes" key="importid"/>
</customfield-searcher>
public class CustomFieldSearch extends ExactNumberSearcher {
public CustomFieldSearch(@ComponentImport FieldVisibilityManager fieldVisibilityManager, @ComponentImport JqlOperandResolver jqlOperandResolver,@ComponentImport DoubleConverter doubleConverter,@ComponentImport CustomFieldInputHelper customFieldInputHelper,@ComponentImport I18nHelper.BeanFactory beanFactory) {
super(fieldVisibilityManager, jqlOperandResolver, doubleConverter, customFieldInputHelper, beanFactory);
}
@Override
public void init(CustomField field) {
super.init(field);
}
@Override
public SearcherInformation<CustomField> getSearchInformation() {
return super.getSearchInformation();
}
@Override
public SearchInputTransformer getSearchInputTransformer() {
return super.getSearchInputTransformer();
}
@Override
public SearchRenderer getSearchRenderer() {
return super.getSearchRenderer();
}
@Override
public CustomFieldSearcherClauseHandler getCustomFieldSearcherClauseHandler() {
return super.getCustomFieldSearcherClauseHandler();
}
@Override
public LuceneFieldSorter getSorter(CustomField customField) {
return super.getSorter(customField);
}
@Override
public String getSortField(CustomField customField) {
return super.getSortField(customField);
}
@Override
public SortField.Type getSortFieldType() {
return super.getSortFieldType();
}
@Override
public void init(CustomFieldSearcherModuleDescriptor customFieldSearcherModuleDescriptor) {
super.init(customFieldSearcherModuleDescriptor);
}
@Override
public CustomFieldSearcherModuleDescriptor getDescriptor() {
return super.getDescriptor();
}
}
search.vm
#disable_html_escaping()
$!{auiparams.put("controlHeaderClass", "aui-field-text")}
#searcherEditHeader (${customField.id} ${customField.name})
<input class="text" id="searcher-$customField.id" name="$customField.id" #if ($configs.styles.style) style="$configs.styles.style"#end type="text" value="$textutils.htmlEncode($!value)" />
#searcherEditFooter (${customField.id} ${customField.descriptionProperty.viewHtml})
$!{auiparams.clear()}
view-seacher.vm
#disable_html_escaping()
#set( $text_invalid_sel = "" )
#if($action.hasAnyErrors())
#set( $text_invalid_sel = "invalid_sel" )
#end
#searcherHeaderNoField ($customField.id $customField.name $text_invalid_sel)
#if ($value)
$textutils.htmlEncode($value)
#end
#searcherFooter ($customField)