How to add Polish language analyzer in Solr8.1

278 Views Asked by At

I am trying to add polish language in solr but it giving the error Plugin init failure for [schema.xml] analyzer/filter: Error loading class 'solr.StempelPolishStemFilterFactory'

Following code i have added:

<fieldType name="text_pl" class="solr.TextField" positionIncrementGap="100">
  <analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_pl.txt" />
    <filter class="solr.StempelPolishStemFilterFactory"/>
  </analyzer>
</fieldType>

reference: https://solr.apache.org/guide/8_0/language-analysis.html#polish

2

There are 2 best solutions below

0
Seasers On BEST ANSWER

To use this filter, you must add additional .jars to Solr’s classpath.

You can go to solr-8.1.0/contrib/analysis-extras/README.txt for instructions on which jars you need to add.

In your case:

Stempel relies on lucene-libs/lucene-analyzers-stempel-X.Y.jar
(i.e. lucene-analyzers-stempel-8.1.0.jar)

So in the solrconfig.xml you should add:

<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-analysis-extras-\d.*\.jar" />
0
Arne On

Don't forget the icu4j depdendency: lib/icu4j-X.Y.jar

<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" regex="icu4j-.*\.jar" />