共计 1895 个字符,预计需要花费 5 分钟才能阅读完成。
Solr 7.2 安装实例与中文分词器
一、安装实例
1、创建实例目录
[root@node004]# mkdir -p /usr/local/solr/home/jonychen
2、复制实例相关配置文件
[root@node004]# cp /usr/local/solr/home/configsets/_default/conf -rf /usr/local/solr/home/jonychen
3、修改 solrConfig.xml
[root@node004]# cp /root/solr-7.2.0/contrib -rf /usr/local/solr/home/
[root@node004]# cp /root/solr-7.2.0/dist -rf /usr/local/solr/home/
[root@node004]# vi /usr/local/solr/home/jonychen/conf/solrconfig.xml
4、通过管理控制台创建
创建实例成功
二、安装中文分词器
1、复制 jar 包
[root@node004 ~]# cd /usr/local/solr/home/contrib/analysis-extras/lucene-libs/
[root@node004 lucene-libs]# cp lucene-analyzers-smartcn-7.2.0.jar /usr/local/solr/apache-tomcat-8.5.24/webapps/solr/WEB-INF/lib/
2、修改 managed-schema
[root@node004 ~]# cd /usr/local/solr/home/jonychen/conf
[root@node004 conf]# vi managed-schema
中文分词器
<!-- ChineseAnalyzer -->
<fieldType name="solr_cnAnalyzer" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="org.apache.lucene.analysis.cn.smart.HMMChineseTokenizerFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="org.apache.lucene.analysis.cn.smart.HMMChineseTokenizerFactory"/>
</analyzer>
</fieldType>
修改默认分词器为中文分词器
3、重新启动 tomcat
[root@node004]# /usr/local/solr/apache-tomcat-8.5.24
[root@node004 apache-tomcat-8.5.24]# ./bin/shutdown.sh
[root@node004 apache-tomcat-8.5.24]# jps
2670 Jps
[root@node004 apache-tomcat-8.5.24]# ps -ef | grep java
root 2681 1988 0 06:10 pts/0 00:00:00 grep java
[root@node004 apache-tomcat-8.5.24]# ./bin/startup.sh
Using CATALINA_BASE: /usr/local/solr/apache-tomcat-8.5.24
Using CATALINA_HOME: /usr/local/solr/apache-tomcat-8.5.24
Using CATALINA_TMPDIR: /usr/local/solr/apache-tomcat-8.5.24/temp
Using JRE_HOME: /usr/local/java/jdk1.8.0_111
Using CLASSPATH: /usr/local/solr/apache-tomcat-8.5.24/bin/bootstrap.jar:/usr/local/solr/apache-tomcat-8.5.24/bin/tomcat-juli.jar
Tomcat started.
[root@node004 apache-tomcat-8.5.24]# tailf ./logs/catalina.out
4、测试
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2018-01/150383.htm