Is there a way to dynamically update a synonym file without restarting Solr server?

前端 未结 2 2033
滥情空心
滥情空心 2020-12-28 10:46

As we know there is a synonym.txt file in conf directory, which I wanted to update whenever I found some new synonym words...

So is there any way to

2条回答
  •  伪装坚强ぢ
    2020-12-28 11:35

    I think you can build your own SynonymFilterFactory that extends the original and use your a custom FSTSynonymFilterFactory as delegator. your SynonymFilterFactory should extends the original SlowSynonymFilterFactory and call:

    map = loadSolrSynonyms(loader, true, analyzer);
    

    whenever you want to reload the synonym file.

    For reloading your file when it changes you can use a watchdog thread that awke up every X time and check whether the sysnonim file was changed or you can use some file watcher to get notification when the file was changed.

提交回复
热议问题