Solr7.4.0+IK Analyzer7.5.0
阿新 • • 發佈:2018-12-17
配置IK分詞
- 到github的ik官方下載ik分詞器,並解壓出來,加到/opt/modules/solr7/tomcat-solr/webapps/solr/WEB-INF/lib
- 在/opt/modules/solr7/tomcat-solr/webapps/solr/WEB-INF/目錄下新建一個classes目錄,加入官方所說的配置檔案
- 修改/opt/modules/solr7/solr_home/new_core/conf/managed-schema檔案,將剛才在data-config.xml中配置的標籤新增進來,並配置IK分詞
[[email protected] solr7]# vim solr_home/new_core/conf/managed-schema
<!-- ik分詞器 --> <fieldType name="text_ik" class="solr.TextField"> <analyzer type="index" useSmart="false" class="org.wltea.analyzer.lucene.IKAnalyzer" /> <analyzer type="query" useSmart="true" class="org.wltea.analyzer.lucene.IKAnalyzer" /> </fieldType> <field name="item_title" type="text_ik" indexed="true" stored="true"/> <field name="item_sell_point" type="text_ik" indexed="true" stored="true"/> <field name="item_price" type="string" indexed="true" stored="true"/> <field name="item_image" type="string" indexed="false" stored="true" /> <field name="item_category_name" type="string" indexed="true" stored="true" /> <field name="item_desc" type="text_ik" indexed="true" stored="false" /> <field name="item_keywords" type="text_ik" indexed="true" stored="false" multiValued="true"/> <copyField source="item_title" dest="item_keywords"/> <copyField source="item_sell_point" dest="item_keywords"/> <copyField source="item_category_name" dest="item_keywords"/> <copyField source="item_desc" dest="item_keywords"/>