【问题标题】:Hibernate search with infinispan, How to store the index in a persistent cache store使用 infinispan 进行休眠搜索,如何将索引存储在持久缓存存储中
【发布时间】:2016-10-21 13:36:24
【问题描述】:

Hibernate 搜索默认 infinispan 配置将索引存储在内存中,一旦关闭应用程序,您必须重新索引所有内容。

我阅读了 infinispan 文档,有一种方法可以将索引存储到 infinispan 文件存储中。在我四处搜索之后,我仍然不知道如何配置它。

【问题讨论】:

    标签: hibernate-search infinispan


    【解决方案1】:

    您可以查看 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”。

    【讨论】:

    • here 也有一些例子。
    • 你救了我的命。我按照示例进行了操作。
    猜你喜欢
    • 2011-12-09
    • 2014-06-07
    • 2017-03-31
    • 2012-03-09
    • 1970-01-01
    • 1970-01-01
    • 2015-11-07
    • 2016-11-22
    • 1970-01-01
    相关资源
    最近更新 更多