Can not use ICUTokenizerFactory in Solr

守給你的承諾、 提交于 2019-11-29 23:47:30

问题


I am trying to use ICUTokenizerFactory in Solr schema. This is how I have defined field and fieldType.

<fieldType name="text_icu" class="solr.TextField" positionIncrementGap="100">
    <analyzer>
        <tokenizer class="solr.ICUTokenizerFactory"/>
    </analyzer>
</fieldType>

<field name="fld_icu" type="text_icu" indexed="true" stored="true"/>

And, when I start Solr, I am get this error

Plugin init failure for [schema.xml] fieldType "text_icu": Plugin init failure for [schema.xml] analyzer/tokenizer: Error loading class 'solr.ICUTokenizerFactory'

I have searched in for that with no success. I don't know if I am missing something or there is some problem in schema. If someone has tried ICUTokenizerFactory then please suggest what could be the problem.


回答1:


From the Wiki:

Lucene provides support for segmenting these languages into syllables with solr.ICUTokenizerFactory in the analysis-extras contrib module. To use this tokenizer, see solr/contrib/analysis-extras/README.txt for instructions on which jars you need to add to your SOLR_HOME/lib




回答2:


Add this at the top of your solrconfig.xml:

<config>
  <lib dir="${user.dir}/../contrib/analysis-extras/lucene-libs/" />
  <lib dir="${user.dir}/../contrib/analysis-extras/lib/" />

This assumes that you are running from example directory with solr.solr.home set to your instance. Otherwise, just use absolute path to your Solr installation.

You can also copy all those jars into lib directory (under your core, not solr home). But the above is an easier way.



来源:https://stackoverflow.com/questions/14601631/can-not-use-icutokenizerfactory-in-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!