Problem while extending TokenizerFactory in Solr 4.4.0
Hi All, I’m using Solr 4.4.0 distro and now, I have a strange issue while extending TokenizerFactory with a custom class. This is an excerpt of pom I use: 4.4.0 org.apache.lucene *lucene*-core ${solr.version} org.apache.lucene *lucene*-analyzers-common ${solr.version} org.apache.lucene *lucene*-*queryparser* ${solr.version} org.apache.solr *solr*-core ${solr.version} I always get the exception below during solr engine initialization: com.mytest.tokenizer.RelationChunkTokenizerFactory' at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:177) at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:467) at org.apache.solr.schema.IndexSchema.(IndexSchema.java:164) 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:619) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.solr.common.SolrException: Plugin init failure for [schema.xml] analyzer/tokenizer: Error instantiating class: 'com.mytest.tokenizer.RelationChunkTokenizerFactory' at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:177) at org.apache.solr.schema.FieldTypePluginLoader.readAnalyzer(FieldTypePluginLoader.java:362) 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.mytest.tokenizer.RelationChunkTokenizerFactory' at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:556) at org.apache.solr.schema.FieldTypePluginLoader$2.create(FieldTypePluginLoader.java:342) at org.apache.solr.schema.FieldTypePluginLoader$2.create(FieldTypePluginLoader.java:335) at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151) ... 18 more Caused by: java.lang.NoSuchMethodException: com.mytest.tokenizer.RelationChunkTokenizerFactory.(java.util.Map) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getConstructor(Unknown Source) at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:552) ... 21 more 8604 [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:1150) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:666) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.solr.common.SolrException: Plugin init failure for [schema.xml] fieldType "rel": Plugin init failure for [schema.xml] analyzer/tokenizer: Error instantiating class: 'com.altilia. platform.tokenizer.RelationChunkTokenizerFactory' at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:177) at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:467) at org.apache.solr.schema.IndexSchema.(IndexSchema.java:164) 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.createFromL
Re: Problem while extending TokenizerFactory in Solr 4.4.0
Hi Shawn, thank you very much for your quick anwser, I fixed it. Thanks Francesco 2014-09-10 15:34 GMT+02:00 Shawn Heisey : > On 9/10/2014 7:14 AM, Francesco Valentini wrote: > > I’m using Solr 4.4.0 distro and now, I have a strange issue while > > extending TokenizerFactory with a custom class. > > I think what we have here is a basic Java error, nothing specific to > Solr. This jumps out at me: > > Caused by: java.lang.NoSuchMethodException: > com.mytest.tokenizer.RelationChunkTokenizerFactory.(java.util.Map) > at java.lang.Class.getConstructor0(Unknown Source) > at java.lang.Class.getConstructor(Unknown Source) > at > > org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:552) > ... 21 more > > Java is trying to execute a method that doesn't exist. The > "getConstructor" pieces after the message suggest that perhaps it's a > constructor with a Map as an argument, but I'm not familiar enough with > this error to know whether it's trying to run a constructor that doesn't > exist, or whether it's trying to actually use a method called "init". > > The constructor in TokenizerFactory is protected, and all of the > existing descendants that I looked at have a public constructor ... this > message would make sense in all of the following situations: > > 1) You didn't create a constructor for your object with a Map argument. > 2) You made your constructor protected. > 3) You made your constructor private. > > Thanks, > Shawn > >
Re: Problem while extending TokenizerFactory in Solr 4.4.0
I recompiled my classes with a public constructor and everything goes well. 2014-09-10 22:00 GMT+02:00 Erick Erickson : > Francesco: > > What was the fix? It'll help others with the same issue. > > On Wed, Sep 10, 2014 at 6:53 AM, Francesco Valentini > wrote: > > Hi Shawn, > > thank you very much for your quick anwser, > > I fixed it. > > > > Thanks > > Francesco > > > > 2014-09-10 15:34 GMT+02:00 Shawn Heisey : > > > >> On 9/10/2014 7:14 AM, Francesco Valentini wrote: > >> > I’m using Solr 4.4.0 distro and now, I have a strange issue while > >> > extending TokenizerFactory with a custom class. > >> > >> I think what we have here is a basic Java error, nothing specific to > >> Solr. This jumps out at me: > >> > >> Caused by: java.lang.NoSuchMethodException: > >> com.mytest.tokenizer.RelationChunkTokenizerFactory.(java.util.Map) > >> at java.lang.Class.getConstructor0(Unknown Source) > >> at java.lang.Class.getConstructor(Unknown Source) > >> at > >> > >> > org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:552) > >> ... 21 more > >> > >> Java is trying to execute a method that doesn't exist. The > >> "getConstructor" pieces after the message suggest that perhaps it's a > >> constructor with a Map as an argument, but I'm not familiar enough with > >> this error to know whether it's trying to run a constructor that doesn't > >> exist, or whether it's trying to actually use a method called "init". > >> > >> The constructor in TokenizerFactory is protected, and all of the > >> existing descendants that I looked at have a public constructor ... this > >> message would make sense in all of the following situations: > >> > >> 1) You didn't create a constructor for your object with a Map argument. > >> 2) You made your constructor protected. > >> 3) You made your constructor private. > >> > >> Thanks, > >> Shawn > >> > >> >
Query parsing issue
Hi, I’ve written my own analyzer to index and query a set of documents. At indexing time everything goes well but now I have a problem in query phase. I need to pass the whole query string to my analyzer before the edismax query parser begins its tasks. In other words I have to preprocess the raw query string. The phrase querying does not fit my needs because I don’t have to match the entire set of terms/tokens. How can I achieve this? Thank you in advance. Francesco
R: Query parsing issue
Thank you very much, I've tried both the way that you have suggested to me. Then I've choosen to re-write the parse method by extending ExtendedDismaxQParser class. Francesco. -Messaggio originale- Da: Tomás Fernández Löbbe [mailto:tomasflo...@gmail.com] Inviato: mercoledì 6 marzo 2013 19:39 A: solr-user@lucene.apache.org Oggetto: Re: Query parsing issue It should be easy to extend ExtendedDismaxQParser and do your pre-processing in the parse() method before calling edismax's parse. Or maybe you could change the way EDismax is splitting the input query into clauses by extending the "splitIntoClauses" method? Tomás On Wed, Mar 6, 2013 at 6:37 AM, Francesco Valentini < francesco.valent...@altiliagroup.com> wrote: > Hi, > > > > Ive written my own analyzer to index and query a set of documents. At > indexing time everything goes well but > > now I have a problem in query phase. > > I need to pass the whole query string to my analyzer before the > edismax query parser begins its tasks. > > In other words I have to preprocess the raw query string. > > The phrase querying does not fit my needs because I dont have to > match the entire set of terms/tokens. > > How can I achieve this? > > > > Thank you in advance. > > > > > > Francesco > > > >