27.2. Configuration
Hibernate Search is configured either in the
META-INF/persistence.xml
or hibernate.cfg.xml
file.
Hibernate Search configuration has sensible defaults for most configuration parameters. The following is an example of a minimal persistence unit configuration:
<persistence-unit name="sample"> <jta-data-source>java:/DefaultDS</jta-data-source> <properties> [...] <!-- use a file system based index --> <property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.FSDirectoryProvider"/> <!-- directory where the indexes will be stored --> <property name="hibernate.search.default.indexBase" value="/Users/prod/apps/dvdstore/dvdindexes"/> </properties> </persistence-unit>
Note
When using Hibernate Search 3.1.x, more event listeners are required, but these are registered automatically by Hibernate Annotations. Refer to the Hibernate Search Reference Guide to learn to configure event listeners without using Hibernate EntityManager and Hibernate Annotations.
The following
JAR
s must be deployed alongside the configuration file:
hibernate-search.jar
hibernate-commons-annotations.jar
lucene-core.jar
Note
If you deploy these in an
EAR
, remember to update application.xml
.