Hi All,

I'm  a novice in Solr and I'm continuously bumping into problems with my
custom filter I'm trying to use for analyzing a fieldType during indexing
as below;

<fieldType name="stanbolRequestType" class="solr.TextField">
  <analyzer type="index">
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class= "com.solr.test.analyzer.ContentFilterFactory"/>
  </analyzer>
</fieldType>

Below is my custom FilterFactory class;

*public class ContentFilterFactory extends TokenFilterFactory {*

* public ContentFilterFactory() {*
* super();*
* }*

* @Override*
* public TokenStream create(TokenStream input) {*
* return new ContentFilter(input);*
* }*
*}*

I'm getting below error stack trace [1] caused by a NoSuchMethodException
when starting the server.
Solr complains that it cannot init the Plugin (my custom filter)  as the
FilterFactory class doesn't have a init method; But in the example [2] I
was following didn't have any notion of a init method in the FilterFactory
class, nor I was required to override an init method when extending
TokenFilterFactory class.

Can someone please help me resolve this error and get my custom filter
working?

Thanks,
Dileepa

[1]
Caused by: org.apache.solr.common.SolrException: Plugin init failure for
[schema.xml] fieldType "stanbolRequestType": Plugin init failure for
[schema.xml] analyzer/filter: Error instantiating class:
'com.solr.test.analyzer.ContentFilterFactory'
at
org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:177)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:468)
... 13 more
Caused by: org.apache.solr.common.SolrException: Plugin init failure for
[schema.xml] analyzer/filter: Error instantiating class:
'com.solr.test.analyzer.ContentFilterFactory'
at
org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:177)
at
org.apache.solr.schema.FieldTypePluginLoader.readAnalyzer(FieldTypePluginLoader.java:400)
at
org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:95)
at
org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:43)
at
org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151)
... 14 more
Caused by: org.apache.solr.common.SolrException: Error instantiating class:
'com.solr.test.analyzer.ContentFilterFactory'
at
org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:556)
at
org.apache.solr.schema.FieldTypePluginLoader$3.create(FieldTypePluginLoader.java:382)
at
org.apache.solr.schema.FieldTypePluginLoader$3.create(FieldTypePluginLoader.java:376)
at
org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151)
... 18 more
Caused by: java.lang.NoSuchMethodException:
com.solr.test.analyzer.ContentFilterFactory.<init>(java.util.Map)
at java.lang.Class.getConstructor0(Class.java:2810)
at java.lang.Class.getConstructor(Class.java:1718)
at
org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:552)
... 21 more

[2] http://solr.pl/en/2012/05/14/developing-your-own-solr-filter/

Reply via email to