microbun / elasticsearch-thulac-plugin

thulac analysis plugin for elasticsearch
190 stars 27 forks source link

Exception in thread "main" java.nio.file.NoSuchFileException when install 7.9.1 #8

Open chuangfengwang opened 2 years ago

chuangfengwang commented 2 years ago

Got error when install 7.9.1. Anything is wrong?

env

ubuntu20.04 elasticsearch version is 7.9.1.

operation is here

download the zip from https://github.com/microbun/elasticsearch-thulac-plugin/releases/tag/7.9.1

bin/elasticsearch-plugin install file:///home/wcf/Setups/elk7.9.1/elasticsearch-plugins/elasticsearch-thulac-plugin-7.9.1.zip

and got exception as follow

-> Installing file:///home/wcf/Setups/elk7.9.1/elasticsearch-plugins/elasticsearch-thulac-plugin-7.9.1.zip
-> Downloading file:///home/wcf/Setups/elk7.9.1/elasticsearch-plugins/elasticsearch-thulac-plugin-7.9.1.zip
[=================================================] 100%   
-> Failed installing file:///home/wcf/Setups/elk7.9.1/elasticsearch-plugins/elasticsearch-thulac-plugin-7.9.1.zip
-> Rolling back file:///home/wcf/Setups/elk7.9.1/elasticsearch-plugins/elasticsearch-thulac-plugin-7.9.1.zip
-> Rolled back file:///home/wcf/Setups/elk7.9.1/elasticsearch-plugins/elasticsearch-thulac-plugin-7.9.1.zip
Exception in thread "main" java.nio.file.NoSuchFileException: /home/wcf/bin/elk7.9.1/elasticsearch/plugins/.installing-3204706613401761985/plugin-descriptor.properties
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:375)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:426)
    at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
    at java.base/java.nio.file.Files.newInputStream(Files.java:160)
    at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:156)
    at org.elasticsearch.plugins.InstallPluginCommand.loadPluginInfo(InstallPluginCommand.java:807)
    at org.elasticsearch.plugins.InstallPluginCommand.installPlugin(InstallPluginCommand.java:866)
    at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:254)
    at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:224)
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
    at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:91)
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
    at org.elasticsearch.cli.Command.main(Command.java:90)
    at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)
kooky126 commented 1 year ago

can’t install by elasticsearch-plugin install


unzip and copy thulac to elasticsearch‘s plugins download models file Models_v1_v2.zip,unzip and copy models to elasticsearch‘s plugins/models

restart elasticsearch


这个插件分词效果不错,新词识别很好,编译稍高版本的ES插件,也很容易(7.16.2版本使用正常),值得推荐,

但是有个问题,如果内容中包含空格时(也许还有其它特殊字符),offset会忽略空格,导致查询结果高亮位置不对。

GET _analyze { "text": "测试 分词,这个一个分词测试", "analyzer":"thulac" }

{ "tokens": [ { "token": "测试", "start_offset": 0, "end_offset": 2, "type": "word", "position": 0 }, { "token": "分词", "start_offset": 2,------IK这里是3 "end_offset": 4,-------IK这里是5 "type": "word", "position": 1 } ] }

查询“分词”的话,高亮结果 测试<em> 分</em>词,这个一<em>个分</em>词测试