【发布时间】:2016-02-11 07:26:46
【问题描述】:
我正在使用 spring boot 并且为了更容易设置(没有用户权限操作),我决定使用 RAM 提供程序而不是 FS。谁能证实我的想法。
- 每当我重新启动时,我都会丢失索引。
- 任何时候通过 Hibernate 的东西都会被自动索引,因为在适当的实体上有 @Indexed 注释。
- 如果重新启动,我需要重建索引,因为它丢失了
try {
FullTextEntityManager fullTextEntityManager =
Search.getFullTextEntityManager(entityManager);
fullTextEntityManager.createIndexer().startAndWait();
} catch (InterruptedException e) {
System.out.println(
"An error occurred trying to build the search index: " +
e.toString());
}
- 如果我将使用 FSDirectoryProvider,索引将自动从 FS 重新加载,并且不再需要上面的代码。除非 ORM 实体发生变化。我想我需要以某种方式手动强制重新索引。
是否有一些可以依赖的 DBDirectory 实现?在这种情况下,索引文件是加载到 RAM 中还是每次对索引的更新都单独写入 DB?
【问题讨论】:
标签: spring lucene spring-boot hibernate-search