前面几节我们看了一下es的基本用法,本节将看一下如何在es中配置分词、停词以及扩展词库。
完成es的安装
https://www.jianshu.com/p/554bafec6049
笔者的solr路径位于 C:\Program Files\elasticsearch-6.2.1
elasticsearch的head管理插件位于 C:\Program Files\elasticsearch-6.2.1\elasticsearch-head
未配置前的测试
重启es服务,测试
我们看到,在配置了分词之后,"江苏","挺好"成为一个词语,这就意味着建立索引,搜索的时候江苏","挺好"不会被拆开。
万和
江苏万和
stopword.dic乃停词库,内容如下,请注意第一行空:
挺好
的
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">ext.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords">stopword.dic</entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>
原文:https://www.cnblogs.com/alichengxuyuan/p/12513403.html