如何在休眠中重用文件系统上已经存在的索引

How to reuse index already present on file system in hibernate

FullTextSession fullTextSession = Search.getFullTextSession(session);
fullTextSession.createIndexer().startAndWait();

来自:http://hibernate.org/search/documentation/getting-started/

每次启动我的应用程序时,我都会取得进展,并且在文件系统上,索引会重置并重新增长。有什么方法可以重用文件系统中的索引吗?

...
    .b.i.SimpleIndexingProgressMonitor  : HSEARCH000031: Indexing speed: 349.166779 documents/second; progress: 89.76%
    2016-12-07 10:57:21.511   INFO 27174 --- [ entityloader-1] o.h.s.b.i.SimpleIndexingProgressMonitor  : HSEARCH000030: 35900 documents indexed in 102821 ms
    ...

当前设置

properties.hibernate.search.default.directory_provider: filesystem
properties.hibernate.search.default.indexBase: /tmp/index

也许我需要另一个目录提供商?

您不需要在每次启动应用程序时都使用 MassIndexer。 删除这两行代码即可。

文件系统 目录提供程序将索引永久存储在您选择的目录中。请注意 /tmp 中的内容可能会被您系统上的其他进程清除。