我想在我的应用程序中使用Hibernate Search;该应用程序包含几个访问搜索索引的模块:
(模块将驻留在同一台物理机器上)
可以这样做吗?是否足够,如果模块之间共享相同的索引目录?是否存在性能损失?
答案 0 :(得分:0)
Yes. There are only performance penalties when you need multiple applications on the same machine to write.
Since in your case only one app will be writing, you can get good performance by allowing that application to use "exclusive mode", and the other applications to read only.
Exclusive mode is the default since version 5.0, so no configuration change is needed for the writer/reader application.
The other applications need to be configured to not open an IndexWriter at bootstrap, which would have them acquire the index writing lock.
Just set this property:
hibernate.search.default.exclusive_index_use = false
One limitation: you can not use the Near-real-time IndexManager described in section 3.2.2, as the writes would not be flushed to disk on each write operation, so the other applications would not see the latest changes.