1

大家好,我正在使用休眠搜索,我现在想指定索引文件的位置,我正在通过以下方式在项目内部进行索引:

@Indexed(index="indexes/myDomainClass")

但我想知道如何将索引指定到我尝试过的应用程序之外的位置

@Indexed(index="/home/indexes/myDomainClass")

但它没有用,有什么想法吗?

4

1 回答 1

3

我正在使用该hibernate.search.default.indexBase属性(在 persistence.xml 或 hibernate.cfg.xml 中)来指定索引的基本目录。

使用AnnotationSessionFactoryB­ean(或任何会话工厂 bean)时,您可以通过以下方式设置各种属性:

<property name="hibernateProperties">
    <util:properties>
          <prop key="hibernate.search.default.indexBase">value</prop>
    </util:properties>
</property>

(你需要 util: 命名空间)

xmlns:util="http://www.springframework.org/schema/util"

并在架构位置:

http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd

于 2011-05-16T10:48:26.623 回答