结巴分词插件(forelasticsearch),目前支持0.90.*以上版本
----------------------------------------------------|JiebaChieseAalysisPlugi|ElasticSearch|----------------------------------------------------|0.0.1-SNAPSHOT(master)|0.90.*|----------------------------------------------------支持两种分词模式(seg_mode):
idex索引模式,搜索引擎建立索引阶段使用该模式search搜索模式,搜索时采用该种模式分词使用说明创建mappig
#!/bi/bashcurl-XDELETE'0:9200/test/';echocurl-XPUT'0:9200/test/'-d'{"idex":{"umber_of_shards":1,"umber_of_replicas":0,"aalysis":{"aalyzer":{"jieba_search":{"type":"jieba","seg_mode":"search","stop":true},"jieba_idex":{"type":"jieba","seg_mode":"idex","stop":true}}}}}';echotest
#idexmodecurl'0:9200/test/_aalyze?aalyzer=jieba_idex'-d'中华人民共和国';echo结果:
{"tokes":[{"toke":"中华","start_offset":0,"ed_offset":2,"type":"word","positio":1},{"toke":"华人","start_offset":1,"ed_offset":3,"type":"word","positio":2},{"toke":"人民","start_offset":2,"ed_offset":4,"type":"word","positio":3},{"toke":"共和","start_offset":4,"ed_offset":6,"type":"word","positio":4},{"toke":"共和国","start_offset":4,"ed_offset":7,"type":"word","positio":5},{"toke":"中华人民共和国","start_offset":0,"ed_offset":7,"type":"word","positio":6}]}#searchmodecurl'0:9200/test/_aalyze?aalyzer=jieba_search'-d'中华人民共和国';echo结果:
{"tokes":[{"toke":"中华人民共和国","start_offset":0,"ed_offset":7,"type":"word","positio":1}]}
评论