Code Monkey home page Code Monkey logo

Comments (9)

cuimo4183 avatar cuimo4183 commented on August 25, 2024

补充,我调用_cache/clear接口也位解决此问题

from elasticsearch-analysis-ansj.

shi-yuan avatar shi-yuan commented on August 25, 2024

是的,analyzer会被放在ThreadLocal里。

热更新问题,在这里修复了:#193

from elasticsearch-analysis-ansj.

cuimo4183 avatar cuimo4183 commented on August 25, 2024

是的,analyzer会被放在ThreadLocal里。

热更新问题,在这里修复了:#193

谢谢,感谢回复,由于线上ES不方便升级大版本,我准备研究下能否采取其他手段进行解决

from elasticsearch-analysis-ansj.

shi-yuan avatar shi-yuan commented on August 25, 2024

可以的,如果需要,这边可以对2.x版本升级
其实插件本身改动不大,核心是nlp-lang的改动

from elasticsearch-analysis-ansj.

cuimo4183 avatar cuimo4183 commented on August 25, 2024

可以的,如果需要,这边可以对2.x版本升级
其实插件本身改动不大,核心是nlp-lang的改动

你好,我看nlp包中加了volatile关键词,照葫芦画瓢也在我这边低版本改了,然后我在analysis-ansj中的两个类也照着改了。启动没问题,不过没有生效,还是间歇性生效,不知道还有哪里的修改点。

from elasticsearch-analysis-ansj.

cuimo4183 avatar cuimo4183 commented on August 25, 2024

可以的,如果需要,这边可以对2.x版本升级
其实插件本身改动不大,核心是nlp-lang的改动

你好,我看nlp包中加了volatile关键词,照葫芦画瓢也在我这边低版本改了,然后我在analysis-ansj中的两个类也照着改了。启动没问题,不过没有生效,还是间歇性生效,不知道还有哪里的修改点。

也没有找到threadlocal 的相关修改点

from elasticsearch-analysis-ansj.

shi-yuan avatar shi-yuan commented on August 25, 2024

ThreadLocal只能是注册的全局的,能控制。如果不是,es注册的是CustomAnalyzer,控制不了的。

所以只能控制,ThreadLocal的value引用,也就是词典

而且词典不能从ENV里移除,如果有变更,只能先clear,再重新加载,如果删除了,clear掉就行

from elasticsearch-analysis-ansj.

cuimo4183 avatar cuimo4183 commented on August 25, 2024

ThreadLocal只能是注册的全局的,能控制。如果不是,es注册的是CustomAnalyzer,控制不了的。

所以只能控制,ThreadLocal的value引用,也就是词典

而且词典不能从ENV里移除,如果有变更,只能先clear,再重新加载,如果删除了,clear掉就行

我看你的代码变动好像是把原来的reload 改成reloadLIbrary方法判断分支,执行reload或者是clear,我没理解到怎么就解决bug了

from elasticsearch-analysis-ansj.

shi-yuan avatar shi-yuan commented on August 25, 2024

reload内部,会先clear,clear执行的时候,会重新初始化branches

......
public class SmartForest<T> implements Comparable<SmartForest<T>>, Serializable {
    ......
    public void clear() {
        this.branches = new SmartForest[65536];
    }
   ......
}

之后再重新读取并加载词典,把词条放入branches

from elasticsearch-analysis-ansj.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.