lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dileepa Jayakody <dileepajayak...@gmail.com>
Subject Re: Help to find BaseTokenFilterFactory to write a Custom TokenFilter
Date Thu, 07 Nov 2013 10:39:16 GMT
Hi All,

When following the above tutorial [1], to write a custom FilterFactory, I
had to extend TokenFilterFactory instead of BaseTokenFilterFactory as per
the API change in new lucene-analyzer-common library.

Below is my custom TokenFilterFactory class:

public class ContentFilterFactory extends TokenFilterFactory{

@Override
public TokenStream create(TokenStream input) {
// TODO Auto-generated method stub
return new ContentFilter(input);
}

}

After configuring the fieldType to use my new filter in the schema.xml I
started the server.

But I'm getting a start-up error instantiating the ContentFilterFactory
class [2] caused by * java.lang.NoSuchMethodException:
com.solr.test.analyzer.ContentFilterFactory.<init>(java.util.Map).*

I haven't included a init method in my FilterFactory class (following the
example).Is it required?

Can somebody please help me resolve this error and instantiate my Filter in
Solr?

Thanks,
Dileepa

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

2969 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer
 – Unable to create core: collection1
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'. Schema file is
/home/dileepa/MyData/desk/solr/solr-4.5.0/example/solr/collection1/schema.xml
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:608)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:166)
at
org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
at
org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
at
org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:521)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:559)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:241)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
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
2971 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer
 – null:org.apache.solr.common.SolrException: Unable to create core:
collection1
at org.apache.solr.core.CoreContainer.recordAndThrow(CoreContainer.java:936)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:568)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:241)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
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'. Schema file is
/home/dileepa/MyData/desk/solr/solr-4.5.0/example/solr/collection1/schema.xml
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:608)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:166)
at
org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
at
org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
at
org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:521)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:559)
... 8 more
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


On Thu, Nov 7, 2013 at 2:39 PM, Dileepa Jayakody
<dileepajayakody@gmail.com>wrote:

> Thanks Anuj,
> The jar containing the class can be found here :
> http://www.java2s.com/Code/JarDownload/lucene/lucene-analyzers-common-4.2.0.jar.zip
>
>
> On Thu, Nov 7, 2013 at 2:18 PM, Anuj Kumar <anujsays@gmail.com> wrote:
>
>>
>> http://stackoverflow.com/questions/13149627/where-did-basetokenfilterfactory-go-in-solr-4-0
>>
>>
>> On Thu, Nov 7, 2013 at 1:05 PM, Dileepa Jayakody
>> <dileepajayakody@gmail.com>wrote:
>>
>> > Hi All,
>> >
>> > I am writing a custom TokenFilter to post a token value to Apache
>> Stanbol
>> > for enhancement. In this Custom TokenFilter I'm trying to retrieve the
>> > response from Stanbol and index it as a new document in Solr.
>> >
>> > I'm following [1] to write a custom filter, but I'm having trouble
>> > locating BaseTokenFilterFactory to create a TokenFactory. Can someone
>> > please point me to a Jar location to get this library?
>> >
>> > Thanks,
>> > Dileepa
>> >
>> > [1] http://solr.pl/en/2012/05/14/developing-your-own-solr-filter/
>> >
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message