Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EdgeNGram: Error instantiating class: 'org.apache.lucene.analysis.ngram.EdgeNGramFilterFactory'

I've set up Solr, so far everything's working just dandy, but now I wanted to add the EdgeNGram functionality to my searches. However, as soon as I throw it into my schema.xml, it starts throwing the error:

org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
Could not load conf for core collection1: Plugin init failure for [schema.xml] 
fieldType "text_en_splitting": Plugin init failure for [schema.xml] analyzer/filter: 
Error instantiating class: 'org.apache.lucene.analysis.ngram.EdgeNGramFilterFactory'. 
Schema file is /opt/solr/server/solr/collection1/conf/schema.xml 

The relevant schema part looks like this:

<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/>

The configuration of the rest of the fieldType is fine as I've tested it rather extensively. It's just adding this line that throws the error.

Now, I've done some looking around, and usually, these errors mean that there's a .jar that's missing (at least according to the other two questions posted on here, not relating to NGram specifically though). So I went ahead and digged up lucene-analyzers-common.jar and explicitly added it in my solrconfig.xml, like so:

<lib dir="${solr.install.dir:../../../..}/dist/" regex="lucene-analyzers-common-\d.*\.jar" />

No luck. I know the path is fine though, I included the mysql_connector just this way. Anyways, I grew pretty tired of this error, so I went ahead and included every single .jar that I could dig up:

<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-.*\.jar" />

Nope.jpg

Of course, all of this was accompanied by many bin/solr stop -all and starts, all of them still serving me that pretty, red banner in the Solr Admin. I'm on Solr 5.0.0

Help?

like image 334
2fat2kidnap Avatar asked Feb 27 '15 19:02

2fat2kidnap


1 Answers

Well, this is awkward, but it's a typical thing to happen to me. Not 5 minutes after I posted this question, I made the error go away [note that I say "error go away", I didn't say "I solved it", because I haven't tested it completely yet].

Anyways, in my filter tag, you see that side="front" tag? Yeah, bad idea apparently. It's odd though, because I found that in the apache docs: https://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.EdgeNGramFilterFactory, I didn't make it up or anything.

Can anyone explain that?

like image 55
2fat2kidnap Avatar answered Nov 12 '22 16:11

2fat2kidnap