使用 infinispan 进行 Hibernate 搜索,如何将索引存储在持久缓存存储中
Hibernate search with infinispan, How to store the index in a persistent cache store
Hibernate 搜索默认 infinispan 配置在内存中存储索引,一旦关闭应用程序,您必须重新索引所有内容。
我阅读了 infinispan 文档,有一种方法可以将索引存储到 infinispan 文件存储中。在我四处搜索之后,我仍然不知道如何配置它。
您可以查看 Infinispan 用户指南第 5 章(持久性)和第 16 章(Infinispan 作为 Lucene 索引的存储)。章节编号来自 Infinispan 8.2。 Hibernate 搜索还提供了一个 "default-hibernatesearch-infinispan.xml" 文件作为开始。您基本上需要为元数据和实际索引缓存添加持久性。这是我用于索引缓存的:
<distributed-cache name="LuceneIndexesData" mode="SYNC" remote-timeout="25000">
<transaction mode="NONE"/>
<state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
<indexing index="NONE"/>
<locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
<eviction max-entries="-1" strategy="NONE"/>
<expiration max-idle="-1"/>
<persistence passivation="false">
<jdbc:string-keyed-jdbc-store preload="true" fetch-state="true" read-only="false" purge="false">
<jdbc:data-source jndi-url="java:comp/env/jdbc/..."/>
<jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">
<jdbc:id-column name="ID" type="VARCHAR(255)"/>
<jdbc:data-column name="DATA" type="MEDIUMBLOB"/>
<jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>
</jdbc:string-keyed-table>
<property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>
<write-behind/>
</jdbc:string-keyed-jdbc-store>
</persistence>
</distributed-cache>
此示例使用 JDBC,因为它适用于动态集群。如果要将索引存储在文件中,则需要将 "jdbc:string-keyed=jdbc-store" 替换为 "file-store"。
Hibernate 搜索默认 infinispan 配置在内存中存储索引,一旦关闭应用程序,您必须重新索引所有内容。
我阅读了 infinispan 文档,有一种方法可以将索引存储到 infinispan 文件存储中。在我四处搜索之后,我仍然不知道如何配置它。
您可以查看 Infinispan 用户指南第 5 章(持久性)和第 16 章(Infinispan 作为 Lucene 索引的存储)。章节编号来自 Infinispan 8.2。 Hibernate 搜索还提供了一个 "default-hibernatesearch-infinispan.xml" 文件作为开始。您基本上需要为元数据和实际索引缓存添加持久性。这是我用于索引缓存的:
<distributed-cache name="LuceneIndexesData" mode="SYNC" remote-timeout="25000">
<transaction mode="NONE"/>
<state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
<indexing index="NONE"/>
<locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
<eviction max-entries="-1" strategy="NONE"/>
<expiration max-idle="-1"/>
<persistence passivation="false">
<jdbc:string-keyed-jdbc-store preload="true" fetch-state="true" read-only="false" purge="false">
<jdbc:data-source jndi-url="java:comp/env/jdbc/..."/>
<jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">
<jdbc:id-column name="ID" type="VARCHAR(255)"/>
<jdbc:data-column name="DATA" type="MEDIUMBLOB"/>
<jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>
</jdbc:string-keyed-table>
<property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>
<write-behind/>
</jdbc:string-keyed-jdbc-store>
</persistence>
</distributed-cache>
此示例使用 JDBC,因为它适用于动态集群。如果要将索引存储在文件中,则需要将 "jdbc:string-keyed=jdbc-store" 替换为 "file-store"。