Hibernate SVN: r20247 - search/trunk/hibernate-search/src/main/docbook/en-US/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-08-24 09:01:16 -0400 (Tue, 24 Aug 2010)
New Revision: 20247
Modified:
search/trunk/hibernate-search/src/main/docbook/en-US/modules/mapping.xml
search/trunk/hibernate-search/src/main/docbook/en-US/modules/query.xml
Log:
HSEARCH-563 doc fixes related to query DSL
Modified: search/trunk/hibernate-search/src/main/docbook/en-US/modules/mapping.xml
===================================================================
--- search/trunk/hibernate-search/src/main/docbook/en-US/modules/mapping.xml 2010-08-24 13:00:42 UTC (rev 20246)
+++ search/trunk/hibernate-search/src/main/docbook/en-US/modules/mapping.xml 2010-08-24 13:01:16 UTC (rev 20247)
@@ -693,9 +693,10 @@
</listitem>
<listitem>
- <para>a list of char filters: each char filter is responsible to
- pre-process input characters before the tokenization. Char filters can add,
- change or remove characters; one common usage is for characters normalization</para>
+ <para>a list of char filters: each char filter is responsible to
+ pre-process input characters before the tokenization. Char filters
+ can add, change or remove characters; one common usage is for
+ characters normalization</para>
</listitem>
<listitem>
@@ -710,20 +711,20 @@
</listitem>
</itemizedlist>
- <para>This separation of tasks - a list of char filters, and a tokenizer followed by a list of
- filters - allows for easy reuse of each individual component and let
- you build your customized analyzer in a very flexible way (just like
- Lego). Generally speaking the <classname>char filters</classname> do some
- pre-processing in the character input, then the <classname>Tokenizer</classname> starts
- the tokenizing process by turning the character input into tokens which
+ <para>This separation of tasks - a list of char filters, and a
+ tokenizer followed by a list of filters - allows for easy reuse of
+ each individual component and let you build your customized analyzer
+ in a very flexible way (just like Lego). Generally speaking the
+ <classname>char filters</classname> do some pre-processing in the
+ character input, then the <classname>Tokenizer</classname> starts the
+ tokenizing process by turning the character input into tokens which
are then further processed by the <classname>TokenFilter</classname>s.
Hibernate Search supports this infrastructure by utilizing the Solr
analyzer framework. Make sure to add<filename> solr-core.jar and
</filename><filename>solr-solrj.jar</filename> to your classpath to
- use analyzer definitions. In case you also want to use the
- snowball stemmer also include the
- <filename>lucene-snowball.jar.</filename> Other Solr analyzers might
- depend on more libraries. For example, the
+ use analyzer definitions. In case you also want to use the snowball
+ stemmer also include the <filename>lucene-snowball.jar.</filename>
+ Other Solr analyzers might depend on more libraries. For example, the
<classname>PhoneticFilterFactory</classname> depends on <ulink
url="http://commons.apache.org/codec">commons-codec</ulink>. Your
distribution of Hibernate Search provides these dependencies in its
@@ -754,21 +755,20 @@
</example>
<para>A char filter is defined by its factory which is responsible for
- building the char filter and using the optional list of parameters.
- In our example, a mapping char filter is used, and will replace
+ building the char filter and using the optional list of parameters. In
+ our example, a mapping char filter is used, and will replace
characters in the input based on the rules specified in the mapping
- file. A tokenizer is also defined by its factory.
- This example use the standard tokenizer. A filter is defined by its factory
- which is responsible for creating the filter instance using the
- optional parameters. In our example, the StopFilter filter is built
- reading the dedicated words property file and is expected to ignore
- case. The list of parameters is dependent on the tokenizer or filter
- factory.</para>
+ file. A tokenizer is also defined by its factory. This example use the
+ standard tokenizer. A filter is defined by its factory which is
+ responsible for creating the filter instance using the optional
+ parameters. In our example, the StopFilter filter is built reading the
+ dedicated words property file and is expected to ignore case. The list
+ of parameters is dependent on the tokenizer or filter factory.</para>
<warning>
- <para>Filters and char filters are applied in the order they are defined in the
- <classname>@AnalyzerDef</classname> annotation. Make sure to think
- twice about this order.</para>
+ <para>Filters and char filters are applied in the order they are
+ defined in the <classname>@AnalyzerDef</classname> annotation. Make
+ sure to think twice about this order.</para>
</warning>
<para>Once defined, an analyzer definition can be reused by an
@@ -815,14 +815,15 @@
<section>
<title>Available analyzers</title>
- <para>Solr and Lucene come with a lot of useful default char filters, tokenizers and
- filters. You can find a complete list of char filter factories, tokenizer factories and
- filter factories at <ulink
+ <para>Solr and Lucene come with a lot of useful default char filters,
+ tokenizers and filters. You can find a complete list of char filter
+ factories, tokenizer factories and filter factories at <ulink
url="http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters">http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters</ulink>.
Let check a few of them.</para>
<table>
<title>Some of the available char filters</title>
+
<tgroup cols="3">
<thead>
<row>
@@ -833,22 +834,23 @@
<entry align="center">parameters</entry>
</row>
</thead>
+
<tbody>
<row>
<entry>MappingCharFilterFactory</entry>
- <entry>Replaces one or more characters with one or more characters, based on mappings
- specified in the resource file</entry>
+ <entry>Replaces one or more characters with one or more
+ characters, based on mappings specified in the resource
+ file</entry>
- <entry><para><literal>mapping</literal>: points to a resource file containing the mappings
- using the format:
- <literallayout>
- "á" => "a"
- "ñ" => "n"
- "ø" => "o"
- </literallayout>
- </para></entry>
+ <entry><para><literal>mapping</literal>: points to a resource
+ file containing the mappings using the format: <literallayout>
+ "á" => "a"
+ "ñ" => "n"
+ "ø" => "o"
+ </literallayout> </para></entry>
</row>
+
<row>
<entry>HTMLStripCharFilterFactory</entry>
@@ -858,7 +860,6 @@
</row>
</tbody>
</tgroup>
-
</table>
<table>
@@ -888,7 +889,8 @@
<entry>HTMLStripStandardTokenizerFactory</entry>
<entry>Remove HTML tags, keep the text and pass it to a
- StandardTokenizer. @Deprecated, use the HTMLStripCharFilterFactory instead</entry>
+ StandardTokenizer. @Deprecated, use the
+ HTMLStripCharFilterFactory instead</entry>
<entry>none</entry>
</row>
@@ -1088,14 +1090,21 @@
you are unsure, use the same analyzers.</para>
</note>
- <para>You can retrieve the scoped analyzer for a given entity used at
- indexing time by Hibernate Search. A scoped analyzer is an analyzer
- which applies the right analyzers depending on the field indexed:
- multiple analyzers can be defined on a given entity each one working
- on an individual field, a scoped analyzer unify all these analyzers
- into a context-aware analyzer. While the theory seems a bit complex,
- using the right analyzer in a query is very easy.</para>
+ <para>If you use the Hibernate Search query DSL (see <xref
+ linkend="search-query-querydsl" />), you don't have to think about it.
+ The query DSL does use the right analyzer transparently for
+ you.</para>
+ <para>If you write your Lucene query using the Lucene programmatic API
+ or the Lucene query parser, you can retrieve the scoped analyzer for a
+ given entity used at indexing time by Hibernate Search. A scoped
+ analyzer is an analyzer which applies the right analyzers depending on
+ the field indexed: multiple analyzers can be defined on a given entity
+ each one working on an individual field, a scoped analyzer unify all
+ these analyzers into a context-aware analyzer. While the theory seems
+ a bit complex, using the right analyzer in a query is very
+ easy.</para>
+
<example>
<title>Using the scoped analyzer when building a full-text
query</title>
@@ -1446,20 +1455,26 @@
<emphasis role="bold">@FieldBridge(impl = DateSplitBridge.class)</emphasis>
private Date date; </programlisting>
</example>
-
- <para>In the previous example the fields where not added directly to Document
- but we where delegating this task to the <classname>LuceneOptions</classname> helper; this will apply the
- options you have selected on <literal>@Field</literal>, like <literal>Store</literal>
- or <literal>TermVector</literal> options, or apply the choosen <classname>@Boost</classname>
- value. It is especially useful to encapsulate the complexity of <literal>COMPRESS</literal>
- implementations so it's recommended to delegate to <classname>LuceneOptions</classname> to add fields to the
+
+ <para>In the previous example the fields where not added directly to
+ Document but we where delegating this task to the
+ <classname>LuceneOptions</classname> helper; this will apply the
+ options you have selected on <literal>@Field</literal>, like
+ <literal>Store</literal> or <literal>TermVector</literal> options, or
+ apply the choosen <classname>@Boost</classname> value. It is
+ especially useful to encapsulate the complexity of
+ <literal>COMPRESS</literal> implementations so it's recommended to
+ delegate to <classname>LuceneOptions</classname> to add fields to the
<classname>Document</classname>, but nothing stops you from editing
- the <classname>Document</classname> directly and ignore the <classname>LuceneOptions</classname> in case you need to.
- </para>
- <tip><para>Classes like <classname>LuceneOptions</classname> are created to shield your application from
- changes in Lucene API and simplify your code. Use them if you can, but if you need more flexibility
- you're not required to.</para></tip>
-
+ the <classname>Document</classname> directly and ignore the
+ <classname>LuceneOptions</classname> in case you need to.</para>
+
+ <tip>
+ <para>Classes like <classname>LuceneOptions</classname> are created
+ to shield your application from changes in Lucene API and simplify
+ your code. Use them if you can, but if you need more flexibility
+ you're not required to.</para>
+ </tip>
</section>
<section>
@@ -1722,8 +1737,8 @@
....
}</programlisting>
</example></para>
- </example>
- The next section demonstrates how to programmatically define analyzers.</para>
+ </example> The next section demonstrates how to programmatically
+ define analyzers.</para>
</section>
<section>
Modified: search/trunk/hibernate-search/src/main/docbook/en-US/modules/query.xml
===================================================================
--- search/trunk/hibernate-search/src/main/docbook/en-US/modules/query.xml 2010-08-24 13:00:42 UTC (rev 20246)
+++ search/trunk/hibernate-search/src/main/docbook/en-US/modules/query.xml 2010-08-24 13:01:16 UTC (rev 20247)
@@ -172,7 +172,7 @@
Action.</para>
</section>
- <section>
+ <section id="search-query-querydsl">
<title>Building a Lucene query with Hibernate Search query DSL</title>
<para>Writing full-text queries with the Lucene programmatic API is
@@ -493,8 +493,11 @@
//look for all myths except religious ones
Query luceneQuery = mythQB
.all()
- .except(
- monthQb.keyword().onField( "description_stem" ).matching( "religion" ).createQuery()
+ .except( monthQb
+ .keyword()
+ .onField( "description_stem"
+ .matching( "religion" )
+ .createQuery()
)
.createQuery();</programlisting></para>
13 years, 7 months
Hibernate SVN: r20246 - search/trunk/hibernate-search/src/main/docbook/en-US/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-08-24 09:00:42 -0400 (Tue, 24 Aug 2010)
New Revision: 20246
Modified:
search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml
Log:
Minor doc style fixes
Modified: search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml
===================================================================
--- search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml 2010-08-24 13:00:12 UTC (rev 20245)
+++ search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml 2010-08-24 13:00:42 UTC (rev 20246)
@@ -344,8 +344,8 @@
“Animal”. Both entities will then be stored in the Animal
directory</para>
- <para><programlisting><code>hibernate.search.org.hibernate.search.test.shards.Furniture.indexName = Animal
-hibernate.search.org.hibernate.search.test.shards.Animal.indexName = Animal</code></programlisting></para>
+ <para><programlisting>hibernate.search.org.hibernate.search.test.shards.Furniture.indexName = Animal
+hibernate.search.org.hibernate.search.test.shards.Animal.indexName = Animal</programlisting></para>
</listitem>
<listitem>
@@ -577,12 +577,15 @@
<example>
<title>Message Driven Bean processing the indexing queue</title>
- <programlisting>@MessageDriven(activationConfig = {
- @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
- @ActivationConfigProperty(propertyName="destination", propertyValue="queue/hibernatesearch"),
+ <programlisting language="JAVA" role="JAVA">@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName="destinationType",
+ propertyValue="javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName="destination",
+ propertyValue="queue/hibernatesearch"),
@ActivationConfigProperty(propertyName="DLQMaxResent", propertyValue="1")
} )
-public class MDBSearchController extends AbstractJMSHibernateSearchController implements MessageListener {
+public class MDBSearchController extends AbstractJMSHibernateSearchController
+ implements MessageListener {
@PersistenceContext EntityManager em;
//method retrieving the appropriate session
@@ -663,7 +666,7 @@
<example>
<title>JGroups transport protocols configuration</title>
- <programlisting>
+ <programlisting language="XML">
## configuration
#udp.xml file needs to be located in the classpath
hibernate.search.worker.backend.jgroups.configurationFile = udp.xml
@@ -1027,12 +1030,15 @@
<section id="search-configuration-directory-lockfactories" revision="1">
<title>LockFactory configuration</title>
+
<para>Lucene Directories have default locking strategies which work well
for most cases, but it's possible to specify for each index managed by
Hibernate Search which LockingFactory you want to use.</para>
+
<para>Some of these locking strategies require a filesystem level lock and
may be used even on RAM based indexes, but this is not recommended and of
no practical use.</para>
+
<para>To select a locking factory, set the
<literal>hibernate.search.<index>.locking_strategy</literal> option
to one of <literal>simple</literal>, <literal>native</literal>,
@@ -1040,68 +1046,76 @@
fully qualified name of an implementation of
<literal>org.hibernate.search.store.LockFactoryFactory</literal>;
Implementing this interface you can provide a custom
- <literal>org.apache.lucene.store.LockFactory</literal>.</para>
+ <literal>org.apache.lucene.store.LockFactory</literal>.</para>
+
<table id="search-configuration-directory-lockfactories-table">
- <title>List of available LockFactory implementations</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry align="center">name</entry>
- <entry align="center">Class</entry>
- <entry align="center">Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>simple</entry>
- <entry>org.apache.lucene.store.SimpleFSLockFactory</entry>
- <entry>
- <para>Safe implementation based on Java's File API, it marks
- the usage of the index by creating a marker file.</para>
- <para>If for some reason you had to kill your application, you
- will need to remove this file before restarting it.</para>
- <para>This is the default implementation for
- <literal>FSDirectoryProvider</literal>,<literal>FSMasterDirectoryProvider</literal>
- and <literal>FSSlaveDirectoryProvider</literal>.</para>
- </entry>
- </row>
- <row>
- <entry>native</entry>
- <entry>org.apache.lucene.store.NativeFSLockFactory</entry>
- <entry>
- <para>As does <literal>simple</literal> this also marks the
- usage of the index by creating a marker file, but this one is
- using native OS file locks so that even if your application
- crashes the locks will be cleaned up.</para>
- <para>This implementation has known problems on NFS.</para>
- </entry>
- </row>
- <row>
- <entry>single</entry>
- <entry>org.apache.lucene.store.SingleInstanceLockFactory</entry>
- <entry>
- <para>This LockFactory doesn't use a file marker but is a Java
- object lock held in memory; therefore it's possible to use it
- only when you are sure the index is not going to be shared by
- any other process.</para>
- <para>This is the default implementation for
- <literal>RAMDirectoryProvider</literal>.</para>
- </entry>
- </row>
- <row>
- <entry>none</entry>
- <entry>org.apache.lucene.store.NoLockFactory</entry>
- <entry>
- <para>All changes to this index are not coordinated by any
- lock; test your application carefully and make sure you know
- what it means.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- Configuration example:</para>
+ <title>List of available LockFactory implementations</title>
+
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry align="center">name</entry>
+
+ <entry align="center">Class</entry>
+
+ <entry align="center">Description</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>simple</entry>
+
+ <entry>org.apache.lucene.store.SimpleFSLockFactory</entry>
+
+ <entry><para>Safe implementation based on Java's File API, it
+ marks the usage of the index by creating a marker file.</para>
+ <para>If for some reason you had to kill your application, you
+ will need to remove this file before restarting it.</para>
+ <para>This is the default implementation for
+ <literal>FSDirectoryProvider</literal>,<literal>FSMasterDirectoryProvider</literal>
+ and <literal>FSSlaveDirectoryProvider</literal>.</para></entry>
+ </row>
+
+ <row>
+ <entry>native</entry>
+
+ <entry>org.apache.lucene.store.NativeFSLockFactory</entry>
+
+ <entry><para>As does <literal>simple</literal> this also marks the
+ usage of the index by creating a marker file, but this one is
+ using native OS file locks so that even if your application
+ crashes the locks will be cleaned up.</para> <para>This
+ implementation has known problems on NFS.</para></entry>
+ </row>
+
+ <row>
+ <entry>single</entry>
+
+ <entry>org.apache.lucene.store.SingleInstanceLockFactory</entry>
+
+ <entry><para>This LockFactory doesn't use a file marker but is a
+ Java object lock held in memory; therefore it's possible to use it
+ only when you are sure the index is not going to be shared by any
+ other process.</para> <para>This is the default implementation for
+ <literal>RAMDirectoryProvider</literal>.</para></entry>
+ </row>
+
+ <row>
+ <entry>none</entry>
+
+ <entry>org.apache.lucene.store.NoLockFactory</entry>
+
+ <entry><para>All changes to this index are not coordinated by any
+ lock; test your application carefully and make sure you know what
+ it means.</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>Configuration example:</para>
+
<programlisting>hibernate.search.default.locking_strategy simple
hibernate.search.Animals.locking_strategy native
hibernate.search.Books.locking_strategy org.custom.components.MyLockingFactory</programlisting>
13 years, 7 months
Hibernate SVN: r20245 - search/trunk/hibernate-search/src/main/docbook/en-US/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-08-24 09:00:12 -0400 (Tue, 24 Aug 2010)
New Revision: 20245
Modified:
search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml
Log:
HSEARCH-563 cosmetic improvements
Modified: search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml
===================================================================
--- search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml 2010-08-24 12:59:38 UTC (rev 20244)
+++ search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml 2010-08-24 13:00:12 UTC (rev 20245)
@@ -162,7 +162,7 @@
<example>
<title>Maven dependencies for Hibernate Search</title>
- <programlisting><dependency>
+ <programlisting language="XML" role="XML"><dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<version>&version;</version>
@@ -208,7 +208,7 @@
<literal><filename>hibernate.cfg.xml</filename></literal> or
<filename>persistence.xml</filename></title>
- <programlisting>...
+ <programlisting language="XML" role="XML">...
<property name="hibernate.search.default.directory_provider"
value="org.hibernate.search.store.FSDirectoryProvider"/>
@@ -244,7 +244,7 @@
<title>Example entities Book and Author before adding Hibernate Search
specific annotations</title>
- <programlisting>package example;
+ <programlisting language="JAVA" role="JAVA">package example;
...
@Entity
public class Book {
@@ -268,7 +268,7 @@
...
}</programlisting>
- <programlisting>package example;
+ <programlisting language="JAVA" role="JAVA">package example;
...
@Entity
public class Author {
@@ -351,7 +351,7 @@
<title>Example entities after adding Hibernate Search
annotations</title>
- <programlisting>package example;
+ <programlisting language="JAVA" role="JAVA">package example;
...
@Entity
<emphasis role="bold">@Indexed</emphasis>
@@ -382,7 +382,7 @@
...
}</programlisting>
- <programlisting>package example;
+ <programlisting language="JAVA" role="JAVA">package example;
...
@Entity
public class Author {
@@ -417,14 +417,14 @@
<example>
<title>Using Hibernate Session to index data</title>
- <programlisting>FullTextSession fullTextSession = Search.getFullTextSession(session);
+ <programlisting language="JAVA" role="JAVA">FullTextSession fullTextSession = Search.getFullTextSession(session);
fullTextSession.createIndexer().startAndWait();</programlisting>
</example>
<example>
<title>Using JPA to index data</title>
- <programlisting>EntityManager em = entityManagerFactory.createEntityManager();
+ <programlisting language="JAVA" role="JAVA">EntityManager em = entityManagerFactory.createEntityManager();
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
fullTextEntityManager.createIndexer().startAndWait();</programlisting>
</example>
@@ -464,7 +464,8 @@
//or their programmatic API. The Hibernate Search DSL is recommended though
// wrap Lucene query in a org.hibernate.Query
-org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(query, Book.class);
+org.hibernate.Query hibQuery =
+ fullTextSession.createFullTextQuery(query, Book.class);
// execute search
List result = hibQuery.list();
@@ -493,7 +494,8 @@
//or their programmatic API. The Hibernate Search DSL is recommended though
// wrap Lucene query in a javax.persistence.Query
-javax.persistence.Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, Book.class);
+javax.persistence.Query persistenceQuery =
+ fullTextEntityManager.createFullTextQuery(query, Book.class);
// execute search
List result = persistenceQuery.getResultList();
@@ -560,7 +562,7 @@
<title>Using <classname>@AnalyzerDef</classname> and the Solr framework
to define and use an analyzer</title>
- <programlisting>package example;
+ <programlisting language="JAVA">package example;
...
@Entity
@Indexed
13 years, 7 months
Hibernate SVN: r20244 - search/trunk/hibernate-search/src/main/docbook/en-US/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-08-24 08:59:38 -0400 (Tue, 24 Aug 2010)
New Revision: 20244
Modified:
search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml
Log:
HSEARCH-563 migrate getting started guide to query DSL
Also refresh Maven config and Core dependency version
Modified: search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml
===================================================================
--- search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml 2010-08-24 12:58:56 UTC (rev 20243)
+++ search/trunk/hibernate-search/src/main/docbook/en-US/modules/getting-started.xml 2010-08-24 12:59:38 UTC (rev 20244)
@@ -108,7 +108,7 @@
<title>Adding the JBoss maven repository to
<filename>settings.xml</filename></title>
- <programlisting><settings>
+ <programlisting language="XML" role="XML"><settings>
...
<profiles>
...
@@ -118,7 +118,7 @@
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
- <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <url>https://repository.jboss.org/nexus/content/groups/public-jboss/<...
<layout>default</layout>
<releases>
<enabled>true</enabled>
@@ -134,7 +134,7 @@
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
- <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <url>https://repository.jboss.org/nexus/content/groups/public-jboss/<...
<layout>default</layout>
<releases>
<enabled>true</enabled>
@@ -154,8 +154,7 @@
<activeProfile>jboss-public-repository</activeProfile>
</activeProfiles>
...
-</settings>
- </programlisting>
+</settings></programlisting>
</example>
<para>Then add the following dependencies to your pom.xml:</para>
@@ -171,7 +170,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <version>3.5.0-Final</version>
+ <version>3.6.0-Beta3</version>
</dependency></programlisting>
</example>
@@ -450,13 +449,19 @@
<example>
<title>Using Hibernate Session to create and execute a search</title>
- <programlisting>FullTextSession fullTextSession = Search.getFullTextSession(session);
+ <programlisting language="JAVA" role="JAVA">FullTextSession fullTextSession = Search.getFullTextSession(session);
Transaction tx = fullTextSession.beginTransaction();
// create native Lucene query
-String[] fields = new String[]{"title", "subtitle", "authors.name", "publicationDate"};
-MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
-org.apache.lucene.search.Query query = parser.parse( "Java rocks!" );
+QueryBuilder qb = fullTextSession.getSearchFactory()
+ .buildQueryBuilder().forEntity( Book.class ).get();
+org.apache.lucene.search.Query query = qb
+ .keyword()
+ .onFields("title", "subtitle", "authors.name", "publicationDate")
+ .matching("Java rocks!");
+ .createQuery();
+//alternatively you can wa\rite the Lucene query using the Lucene query parser
+//or their programmatic API. The Hibernate Search DSL is recommended though
// wrap Lucene query in a org.hibernate.Query
org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(query, Book.class);
@@ -471,15 +476,21 @@
<example>
<title>Using JPA to create and execute a search</title>
- <programlisting>EntityManager em = entityManagerFactory.createEntityManager();
+ <programlisting language="JAVA" role="JAVA">EntityManager em = entityManagerFactory.createEntityManager();
FullTextEntityManager fullTextEntityManager =
org.hibernate.search.jpa.Search.getFullTextEntityManager(em);
em.getTransaction().begin();
// create native Lucene query
-String[] fields = new String[]{"title", "subtitle", "authors.name", "publicationDate"};
-MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
-org.apache.lucene.search.Query query = parser.parse( "Java rocks!" );
+QueryBuilder qb = fullTextSession.getSearchFactory()
+ .buildQueryBuilder().forEntity( Book.class ).get();
+org.apache.lucene.search.Query query = qb
+ .keyword()
+ .onFields("title", "subtitle", "authors.name", "publicationDate")
+ .matching("Java rocks!");
+ .createQuery();
+//alternatively you can wa\rite the Lucene query using the Lucene query parser
+//or their programmatic API. The Hibernate Search DSL is recommended though
// wrap Lucene query in a javax.persistence.Query
javax.persistence.Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, Book.class);
13 years, 7 months
Hibernate SVN: r20243 - in search/trunk/hibernate-search/src/main/java/org/hibernate/search: backend/configuration and 10 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-08-24 08:58:56 -0400 (Tue, 24 Aug 2010)
New Revision: 20243
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/WorkerFactory.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/configuration/ConfigurationParseHelper.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigDecimalBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BooleanBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CalendarBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CharacterBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ClassBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DateBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DoubleBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/EnumBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/FloatBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/IntegerBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/LongBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ShortBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UriBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UrlBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ConfigContext.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ImmutableSearchFactory.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/SearchFactoryBuilder.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/jmx/IndexControl.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/reader/ReaderProviderFactory.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/stat/StatisticsImpl.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderFactory.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateSearchResourceLoader.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/PluginLoader.java
Log:
HSEARCH-581 No longer use Core's Helper classes
Make use of Hibernate Commons Annotations instead
We need to limit our dependencies to Core esp to non public contracts
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/WorkerFactory.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/WorkerFactory.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/WorkerFactory.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -27,12 +27,12 @@
import java.util.Map;
import java.util.Properties;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.Environment;
import org.hibernate.search.spi.WorkerBuildContext;
import org.hibernate.search.backend.impl.TransactionalWorker;
import org.hibernate.search.cfg.SearchConfiguration;
import org.hibernate.search.util.PluginLoader;
-import org.hibernate.util.StringHelper;
/**
* @author Emmanuel Bernard
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/configuration/ConfigurationParseHelper.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/configuration/ConfigurationParseHelper.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/configuration/ConfigurationParseHelper.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -26,7 +26,7 @@
import java.util.Properties;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.SearchException;
/**
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -36,6 +36,7 @@
import org.slf4j.Logger;
import org.hibernate.annotations.common.AssertionFailure;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
import org.hibernate.search.spi.WorkerBuildContext;
@@ -60,7 +61,6 @@
import org.hibernate.search.util.HibernateHelper;
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.search.util.PluginLoader;
-import org.hibernate.util.StringHelper;
/**
* Batch work until {@link #performWorks} is called.
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigDecimalBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigDecimalBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigDecimalBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -26,7 +26,7 @@
import java.math.BigDecimal;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map a BigDecimal element
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -26,7 +26,7 @@
import java.math.BigInteger;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map a <code>BigInteger</code> element.
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BooleanBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BooleanBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/BooleanBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,8 +24,8 @@
*/
package org.hibernate.search.bridge.builtin;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.bridge.TwoWayStringBridge;
-import org.hibernate.util.StringHelper;
/**
* Map a boolean field
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CalendarBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CalendarBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CalendarBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,11 +24,11 @@
*/
package org.hibernate.search.bridge.builtin;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.SearchException;
import org.hibernate.search.annotations.Resolution;
import org.hibernate.search.bridge.ParameterizedBridge;
import org.hibernate.search.bridge.TwoWayStringBridge;
-import org.hibernate.util.StringHelper;
import org.apache.lucene.document.DateTools;
import java.util.Date;
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CharacterBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CharacterBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/CharacterBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,7 +24,7 @@
*/
package org.hibernate.search.bridge.builtin;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map a character element
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ClassBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ClassBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ClassBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,10 +24,10 @@
*/
package org.hibernate.search.bridge.builtin;
+import org.hibernate.annotations.common.util.ReflectHelper;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.bridge.TwoWayStringBridge;
import org.hibernate.search.SearchException;
-import org.hibernate.util.StringHelper;
-import org.hibernate.util.ReflectHelper;
/**
* Convert a Class back and forth
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DateBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DateBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DateBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -30,11 +30,12 @@
import java.util.Map;
import org.apache.lucene.document.DateTools;
+
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.SearchException;
import org.hibernate.search.bridge.ParameterizedBridge;
import org.hibernate.search.annotations.Resolution;
import org.hibernate.search.bridge.TwoWayStringBridge;
-import org.hibernate.util.StringHelper;
/**
* Bridge a java.util.Date to a String, truncated to the resolution
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DoubleBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DoubleBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/DoubleBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,7 +24,7 @@
*/
package org.hibernate.search.bridge.builtin;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map a double element
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/EnumBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/EnumBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/EnumBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,8 +24,8 @@
*/
package org.hibernate.search.bridge.builtin;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.bridge.TwoWayStringBridge;
-import org.hibernate.util.StringHelper;
/**
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/FloatBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/FloatBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/FloatBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,7 +24,7 @@
*/
package org.hibernate.search.bridge.builtin;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map a float element
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/IntegerBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/IntegerBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/IntegerBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,7 +24,7 @@
*/
package org.hibernate.search.bridge.builtin;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map an integer element
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/LongBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/LongBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/LongBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,7 +24,7 @@
*/
package org.hibernate.search.bridge.builtin;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map a long element
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ShortBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ShortBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/ShortBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,7 +24,7 @@
*/
package org.hibernate.search.bridge.builtin;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
/**
* Map a short element
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UriBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UriBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UriBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -27,7 +27,7 @@
import java.net.URI;
import java.net.URISyntaxException;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.SearchException;
import org.hibernate.search.bridge.TwoWayStringBridge;
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UrlBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UrlBridge.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/builtin/UrlBridge.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -27,9 +27,9 @@
import java.net.URL;
import java.net.MalformedURLException;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.bridge.TwoWayStringBridge;
import org.hibernate.search.SearchException;
-import org.hibernate.util.StringHelper;
/**
* Bridge for <code>URL</code>s.
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -46,6 +46,7 @@
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMember;
import org.hibernate.annotations.common.reflection.XProperty;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.SearchException;
import org.hibernate.search.analyzer.Discriminator;
import org.hibernate.search.annotations.AnalyzerDef;
@@ -71,7 +72,6 @@
import org.hibernate.search.util.PassThroughAnalyzer;
import org.hibernate.search.util.ReflectionHelper;
import org.hibernate.search.util.ScopedAnalyzer;
-import org.hibernate.util.StringHelper;
/**
* Set up and provide a manager for classes which are indexed via <code>@IndexedEmbedded</code>, but themselves do not
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -27,8 +27,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.annotations.common.util.ReflectHelper;
+
/**
* @author Emmanuel Bernard
*/
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ConfigContext.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ConfigContext.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ConfigContext.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -34,6 +34,8 @@
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.search.Similarity;
+import org.hibernate.annotations.common.util.ReflectHelper;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
import org.hibernate.search.annotations.AnalyzerDef;
@@ -41,8 +43,6 @@
import org.hibernate.search.util.DelegateNamedAnalyzer;
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.search.util.PluginLoader;
-import org.hibernate.util.ReflectHelper;
-import org.hibernate.util.StringHelper;
import org.slf4j.Logger;
/**
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ImmutableSearchFactory.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ImmutableSearchFactory.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/ImmutableSearchFactory.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -37,6 +37,7 @@
import org.slf4j.Logger;
import org.hibernate.annotations.common.AssertionFailure;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
import org.hibernate.search.Version;
@@ -72,7 +73,6 @@
import org.hibernate.search.store.optimization.OptimizerStrategy;
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.search.util.PluginLoader;
-import org.hibernate.util.StringHelper;
/**
* This implementation is never directly exposed to the user, it is always wrapped into a {@link org.hibernate.search.impl.MutableSearchFactory}
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/SearchFactoryBuilder.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/SearchFactoryBuilder.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/impl/SearchFactoryBuilder.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -45,6 +45,7 @@
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
import org.hibernate.search.Version;
@@ -89,7 +90,6 @@
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.search.util.PluginLoader;
import org.hibernate.search.util.ReflectionHelper;
-import org.hibernate.util.StringHelper;
/**
* Build a search factory.
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/jmx/IndexControl.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/jmx/IndexControl.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/jmx/IndexControl.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -30,10 +30,10 @@
import org.hibernate.CacheMode;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.Search;
import org.hibernate.search.util.JNDIHelper;
-import org.hibernate.util.ReflectHelper;
/**
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -58,6 +58,7 @@
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
+import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.query.ParameterMetadata;
import org.hibernate.impl.AbstractQueryImpl;
@@ -86,7 +87,6 @@
import org.hibernate.search.util.ContextHelper;
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.transform.ResultTransformer;
-import org.hibernate.util.ReflectHelper;
import static org.hibernate.search.reader.ReaderProviderHelper.getIndexReaders;
import static org.hibernate.search.util.FilterCacheModeTypeHelper.cacheInstance;
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/reader/ReaderProviderFactory.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/reader/ReaderProviderFactory.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/reader/ReaderProviderFactory.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -27,11 +27,11 @@
import java.util.Map;
import java.util.Properties;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.Environment;
import org.hibernate.search.spi.BuildContext;
import org.hibernate.search.cfg.SearchConfiguration;
import org.hibernate.search.util.PluginLoader;
-import org.hibernate.util.StringHelper;
/**
* @author Emmanuel Bernard
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/stat/StatisticsImpl.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/stat/StatisticsImpl.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/stat/StatisticsImpl.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -42,12 +42,12 @@
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
+import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.search.ProjectionConstants;
import org.hibernate.search.Version;
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.search.reader.ReaderProvider;
import org.hibernate.search.store.DirectoryProvider;
-import org.hibernate.util.ReflectHelper;
/**
* A concurrent implementation of the {@code Statistics} interface.
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderFactory.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderFactory.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderFactory.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -31,6 +31,7 @@
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.Environment;
import org.hibernate.search.spi.WritableBuildContext;
import org.hibernate.search.SearchException;
@@ -43,7 +44,6 @@
import org.hibernate.search.store.optimization.NoOpOptimizerStrategy;
import org.hibernate.search.store.optimization.OptimizerStrategy;
import org.hibernate.search.util.PluginLoader;
-import org.hibernate.util.StringHelper;
/**
* Create a Lucene directory provider which can be configured
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -39,7 +39,7 @@
import org.apache.lucene.store.SingleInstanceLockFactory;
import org.slf4j.Logger;
-import org.hibernate.util.StringHelper;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.search.SearchException;
import org.hibernate.search.util.FileHelper;
import org.hibernate.search.util.LoggerFactory;
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateSearchResourceLoader.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateSearchResourceLoader.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateSearchResourceLoader.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -35,7 +35,7 @@
import org.apache.solr.common.ResourceLoader;
import org.apache.solr.util.plugin.ResourceLoaderAware;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.search.SearchException;
/**
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/PluginLoader.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/PluginLoader.java 2010-08-24 12:51:19 UTC (rev 20242)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/PluginLoader.java 2010-08-24 12:58:56 UTC (rev 20243)
@@ -24,8 +24,8 @@
*/
package org.hibernate.search.util;
+import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.search.SearchException;
-import org.hibernate.util.ReflectHelper;
/**
* Utility class to load instances of other classes by using a fully qualified name,
13 years, 7 months
Hibernate SVN: r20242 - search/trunk.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-08-24 08:51:19 -0400 (Tue, 24 Aug 2010)
New Revision: 20242
Modified:
search/trunk/pom.xml
Log:
HSEARCH-584 upgrade to core 3.6.0.Beta3
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2010-08-24 12:50:58 UTC (rev 20241)
+++ search/trunk/pom.xml 2010-08-24 12:51:19 UTC (rev 20242)
@@ -130,7 +130,7 @@
<properties>
<slf4jVersion>1.6.1</slf4jVersion>
<luceneVersion>2.9.2</luceneVersion>
- <hibernateVersion>3.6.0.Beta1</hibernateVersion>
+ <hibernateVersion>3.6.0.Beta3</hibernateVersion>
<hibernateCommonsAnnotationVersion>3.2.0.Final</hibernateCommonsAnnotationVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
13 years, 7 months
Hibernate SVN: r20241 - in search/trunk/hibernate-search/src/main/java/org/hibernate/search: util and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-08-24 08:50:58 -0400 (Tue, 24 Aug 2010)
New Revision: 20241
Added:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/SoftLimitMRUCache.java
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/CachingWrapperFilter.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/MRUFilterCachingStrategy.java
Log:
HSEARCH-580 No longer depend on Core's SoftLimitMRUCache implem
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/CachingWrapperFilter.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/CachingWrapperFilter.java 2010-08-24 10:47:18 UTC (rev 20240)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/CachingWrapperFilter.java 2010-08-24 12:50:58 UTC (rev 20241)
@@ -32,7 +32,7 @@
import org.slf4j.Logger;
import org.hibernate.search.util.LoggerFactory;
-import org.hibernate.util.SoftLimitMRUCache;
+import org.hibernate.search.util.SoftLimitMRUCache;
/**
* A slightly different version of Lucene's original <code>CachingWrapperFilter</code> which
@@ -58,6 +58,12 @@
private final Filter filter;
/**
+ * Under memory pressure the JVM will release all Soft references,
+ * so pushing it too high will invalidate all eventually useful other caches.
+ */
+ private static final int HARD_TO_SOFT_RATIO = 15;
+
+ /**
* @param filter Filter to cache results of
*/
public CachingWrapperFilter(Filter filter) {
@@ -69,8 +75,9 @@
*/
public CachingWrapperFilter(Filter filter, int size) {
this.filter = filter;
- log.debug( "Initialising SoftLimitMRUCache with hard ref size of {}", size );
- this.cache = new SoftLimitMRUCache( size );
+ final int softRefSize = size * HARD_TO_SOFT_RATIO;
+ log.debug( "Initialising SoftLimitMRUCache with hard ref size of {} and a soft ref of {}", size, softRefSize );
+ this.cache = new SoftLimitMRUCache( size, softRefSize );
}
@Override
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/MRUFilterCachingStrategy.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/MRUFilterCachingStrategy.java 2010-08-24 10:47:18 UTC (rev 20240)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/filter/MRUFilterCachingStrategy.java 2010-08-24 12:50:58 UTC (rev 20241)
@@ -29,7 +29,7 @@
import org.apache.lucene.search.Filter;
import org.hibernate.search.Environment;
import org.hibernate.search.backend.configuration.ConfigurationParseHelper;
-import org.hibernate.util.SoftLimitMRUCache;
+import org.hibernate.search.util.SoftLimitMRUCache;
/**
* Keep the most recently used Filters in the cache
@@ -43,9 +43,15 @@
private SoftLimitMRUCache cache;
private static final String SIZE = Environment.FILTER_CACHING_STRATEGY + ".size";
+ /**
+ * Under memory pressure the JVM will release all Soft references,
+ * so pushing it too high will invalidate all eventually useful other caches.
+ */
+ private static final int HARD_TO_SOFT_RATIO = 15;
+
public void initialize(Properties properties) {
int size = ConfigurationParseHelper.getIntValue( properties, SIZE, DEFAULT_SIZE );
- cache = new SoftLimitMRUCache( size );
+ cache = new SoftLimitMRUCache( size, size * HARD_TO_SOFT_RATIO );
}
public Filter getCachedFilter(FilterKey key) {
Added: search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/SoftLimitMRUCache.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/SoftLimitMRUCache.java (rev 0)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/SoftLimitMRUCache.java 2010-08-24 12:50:58 UTC (rev 20241)
@@ -0,0 +1,236 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.search.util;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
+
+import org.hibernate.util.LRUMap;
+
+/**
+ * Cache following a "Most Recently Used" (MRU) algorithm for maintaining a
+ * bounded in-memory size; the "Least Recently Used" (LRU) entry is the first
+ * available for removal from the cache.
+ * <p/>
+ * This implementation uses a "soft limit" to the in-memory size of the cache,
+ * meaning that all cache entries are kept within a completely
+ * {@link java.lang.ref.SoftReference}-based map with the most recently utilized
+ * entries additionally kept in a hard-reference manner to prevent those cache
+ * entries soft references from becoming enqueued by the garbage collector. Thus
+ * the actual size of this cache impl can actually grow beyond the stated max
+ * size bound as long as GC is not actively seeking soft references for
+ * enqueuement.
+ * <p/>
+ * The soft-size is bounded and configurable. This allows controlling memory
+ * usage which can grow out of control under some circumstances, especially when
+ * very large heaps are in use. Although memory usage per se should not be a
+ * problem with soft references, which are cleared when necessary, this can
+ * trigger extremely slow stop-the-world GC pauses when nearing full heap usage,
+ * even with CMS concurrent GC (i.e. concurrent mode failure). This is most
+ * evident when ad-hoc HQL queries are produced by the application, leading to
+ * poor soft-cache hit ratios. This can also occur with heavy use of SQL IN
+ * clauses, which will generate multiples SQL queries (even if parameterized),
+ * one for each collection/array size passed to the IN clause. Many slightly
+ * different queries will eventually fill the heap and trigger a full GC to
+ * reclaim space, leading to unacceptable pauses in some cases.
+ * <p/>
+ * <strong>Note:</strong> This class is serializable, however all entries are
+ * discarded on serialization.
+ *
+ * @see org.hibernate.cfg.Environment#QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES
+ * @see org.hibernate.cfg.Environment#QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES
+ *
+ * @author Steve Ebersole
+ * @author Manuel Dominguez Sarmiento
+ *
+ * Copied from Hibernate Core
+ */
+public class SoftLimitMRUCache implements Serializable {
+ /**
+ * The default strong reference count.
+ */
+ public static final int DEFAULT_STRONG_REF_COUNT = 128;
+
+ /**
+ * The default soft reference count.
+ */
+ public static final int DEFAULT_SOFT_REF_COUNT = 2048;
+
+ private final int strongRefCount;
+ private final int softRefCount;
+
+ private transient LRUMap strongRefCache;
+ private transient LRUMap softRefCache;
+ private transient ReferenceQueue referenceQueue;
+
+ /**
+ * Constructs a cache with the default settings.
+ *
+ * @see #DEFAULT_STRONG_REF_COUNT
+ * @see #DEFAULT_SOFT_REF_COUNT
+ */
+ public SoftLimitMRUCache() {
+ this( DEFAULT_STRONG_REF_COUNT, DEFAULT_SOFT_REF_COUNT );
+ }
+
+ /**
+ * Constructs a cache with the specified settings.
+ *
+ * @param strongRefCount the strong reference count.
+ * @param softRefCount the soft reference count.
+ *
+ * @throws IllegalArgumentException if either of the arguments is less than one, or if the strong
+ * reference count is higher than the soft reference count.
+ */
+ public SoftLimitMRUCache(int strongRefCount, int softRefCount) {
+ if ( strongRefCount < 1 || softRefCount < 1 ) {
+ throw new IllegalArgumentException( "Reference counts must be greater than zero" );
+ }
+ if ( strongRefCount > softRefCount ) {
+ throw new IllegalArgumentException( "Strong reference count cannot exceed soft reference count" );
+ }
+
+ this.strongRefCount = strongRefCount;
+ this.softRefCount = softRefCount;
+ init();
+ }
+
+ /**
+ * Gets an object from the cache.
+ *
+ * @param key the cache key.
+ *
+ * @return the stored value, or <code>null</code> if no entry exists.
+ */
+ public synchronized Object get(Object key) {
+ if ( key == null ) {
+ throw new NullPointerException( "Key to get cannot be null" );
+ }
+
+ clearObsoleteReferences();
+
+ SoftReference ref = (SoftReference) softRefCache.get( key );
+ if ( ref != null ) {
+ Object refValue = ref.get();
+ if ( refValue != null ) {
+ // This ensures recently used entries are strongly-reachable
+ strongRefCache.put( key, refValue );
+ return refValue;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Puts a value in the cache.
+ *
+ * @param key the key.
+ * @param value the value.
+ *
+ * @return the previous value stored in the cache, if any.
+ */
+ public synchronized Object put(Object key, Object value) {
+ if ( key == null || value == null ) {
+ throw new NullPointerException(
+ getClass().getName() + "does not support null key [" + key + "] or value [" + value + "]"
+ );
+ }
+
+ clearObsoleteReferences();
+
+ strongRefCache.put( key, value );
+ SoftReference ref = (SoftReference) softRefCache.put(
+ key,
+ new KeyedSoftReference( key, value, referenceQueue )
+ );
+
+ return ( ref != null ) ? ref.get() : null;
+ }
+
+ /**
+ * Gets the strong reference cache size.
+ *
+ * @return the strong reference cache size.
+ */
+ public synchronized int size() {
+ clearObsoleteReferences();
+ return strongRefCache.size();
+ }
+
+ /**
+ * Gets the soft reference cache size.
+ *
+ * @return the soft reference cache size.
+ */
+ public synchronized int softSize() {
+ clearObsoleteReferences();
+ return softRefCache.size();
+ }
+
+ /**
+ * Clears the cache.
+ */
+ public synchronized void clear() {
+ strongRefCache.clear();
+ softRefCache.clear();
+ }
+
+ private void init() {
+ this.strongRefCache = new LRUMap( strongRefCount );
+ this.softRefCache = new LRUMap( softRefCount );
+ this.referenceQueue = new ReferenceQueue();
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ init();
+ }
+
+ private void clearObsoleteReferences() {
+ // Clear entries for soft references removed by garbage collector
+ KeyedSoftReference obsoleteRef;
+ while ( ( obsoleteRef = (KeyedSoftReference) referenceQueue.poll() ) != null ) {
+ Object key = obsoleteRef.getKey();
+ softRefCache.remove( key );
+ }
+ }
+
+ private static class KeyedSoftReference extends SoftReference {
+ private final Object key;
+
+ @SuppressWarnings({ "unchecked" })
+ private KeyedSoftReference(Object key, Object value, ReferenceQueue q) {
+ super( value, q );
+ this.key = key;
+ }
+
+ private Object getKey() {
+ return key;
+ }
+ }
+}
+
13 years, 7 months
Hibernate SVN: r20240 - validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validator.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-08-24 06:47:18 -0400 (Tue, 24 Aug 2010)
New Revision: 20240
Added:
validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_zh_CN.properties
Log:
HV-359 chinese message template
Added: validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_zh_CN.properties
===================================================================
--- validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_zh_CN.properties (rev 0)
+++ validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_zh_CN.properties 2010-08-24 10:47:18 UTC (rev 20240)
@@ -0,0 +1,21 @@
+javax.validation.constraints.AssertFalse.message=\u53ea\u80fd\u4e3afalse
+javax.validation.constraints.AssertTrue.message=\u53ea\u80fd\u4e3atrue
+javax.validation.constraints.DecimalMax.message=\u5fc5\u987b\u5c0f\u4e8e\u6216\u7b49\u4e8e{value}
+javax.validation.constraints.DecimalMin.message=\u5fc5\u987b\u5927\u4e8e\u6216\u7b49\u4e8e{value}
+javax.validation.constraints.Digits.message=\u6570\u5b57\u7684\u503c\u8d85\u51fa\u4e86\u5141\u8bb8\u8303\u56f4(\u53ea\u5141\u8bb8\u5728{integer}\u4f4d\u6574\u6570\u548c{fraction}\u4f4d\u5c0f\u6570\u8303\u56f4\u5185)
+javax.validation.constraints.Future.message=\u9700\u8981\u662f\u4e00\u4e2a\u5c06\u6765\u7684\u65f6\u95f4
+javax.validation.constraints.Max.message=\u6700\u5927\u4e0d\u80fd\u8d85\u8fc7{value}
+javax.validation.constraints.Min.message=\u6700\u5c0f\u4e0d\u80fd\u5c0f\u4e8e{value}
+javax.validation.constraints.NotNull.message=\u4e0d\u80fd\u4e3anull
+javax.validation.constraints.Null.message=\u5fc5\u987b\u4e3anull
+javax.validation.constraints.Past.message=\u9700\u8981\u662f\u4e00\u4e2a\u8fc7\u53bb\u7684\u4e8b\u4ef6
+javax.validation.constraints.Pattern.message=\u9700\u8981\u5339\u914d\u6b63\u5219\u8868\u8fbe\u5f0f"{regexp}"
+javax.validation.constraints.Size.message=\u4e2a\u6570\u5fc5\u987b\u5728{min}\u548c{max}\u4e4b\u95f4
+org.hibernate.validator.constraints.Email.message=\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740
+org.hibernate.validator.constraints.Length.message=\u957f\u5ea6\u9700\u8981\u5728{min}\u548c{max}\u4e4b\u95f4
+org.hibernate.validator.constraints.NotBlank.message=\u4e0d\u80fd\u4e3a\u7a7a
+org.hibernate.validator.constraints.NotEmpty.message=\u4e0d\u80fd\u4e3a\u7a7a
+org.hibernate.validator.constraints.Range.message=\u9700\u8981\u5728{min}\u548c{max}\u4e4b\u95f4
+org.hibernate.validator.constraints.URL.message=\u9700\u8981\u662f\u4e00\u4e2a\u5408\u6cd5\u7684URL
+org.hibernate.validator.constraints.CreditCardNumber.message=\u4e0d\u5408\u6cd5\u7684\u4fe1\u7528\u5361\u53f7\u7801
+org.hibernate.validator.constraints.ScriptAssert.message=\u6267\u884c\u811a\u672c\u8868\u8fbe\u5f0f"{script}"\u6ca1\u6709\u80fd\u591f\u5f97\u5230true
13 years, 7 months
Hibernate SVN: r20239 - search/trunk.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-08-24 06:18:36 -0400 (Tue, 24 Aug 2010)
New Revision: 20239
Modified:
search/trunk/pom.xml
Log:
HSEARCH-583 Added enforcer plugin to master pom
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2010-08-24 08:26:18 UTC (rev 20238)
+++ search/trunk/pom.xml 2010-08-24 10:18:36 UTC (rev 20239)
@@ -1,28 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat, Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat, Inc. and/or its affiliates or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat, Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate</groupId>
@@ -332,6 +334,27 @@
</archive>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <executions>
+ <execution>
+ <id>enforce-java</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <rules>
+ <requireJavaVersion>
+ <!-- require JDK 1.6 to run the build -->
+ <version>[1.6,)</version>
+ </requireJavaVersion>
+ </rules>
+ </configuration>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -470,8 +493,8 @@
<jdbc.driver>org.hsqldb.jdbcDriver</jdbc.driver>
<jdbc.url>jdbc:hsqldb:.</jdbc.url>
<jdbc.user>sa</jdbc.user>
- <jdbc.pass />
- <jdbc.isolation />
+ <jdbc.pass/>
+ <jdbc.isolation/>
</properties>
</profile>
<!--
@@ -498,7 +521,7 @@
<jdbc.url>jdbc:mysql://vmg08.mw.lab.eng.bos.redhat.com/searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -518,7 +541,7 @@
<jdbc.url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com/searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -539,7 +562,7 @@
</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -560,7 +583,7 @@
<jdbc.url>jdbc:postgresql://vmg01.mw.lab.eng.bos.redhat.com:5432:searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -581,7 +604,7 @@
<jdbc.url>jdbc:postgresql://vmg03.mw.lab.eng.bos.redhat.com:5432:searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -601,7 +624,7 @@
<jdbc.url>jdbc:postgresql://notinstalled.lab.eng.bos.redhat.com:5432:searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -632,7 +655,7 @@
<jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -657,7 +680,7 @@
<jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -682,7 +705,7 @@
<jdbc.url>jdbc:db2://vmg06.mw.lab.eng.bos.redhat.com:50000/jbossqa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -703,7 +726,7 @@
<jdbc.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -724,7 +747,7 @@
<jdbc.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qaora10</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -744,7 +767,7 @@
<jdbc.url>jdbc:oracle:thin:@dev04.qa.atl2.redhat.com:1521:qaora11</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -766,7 +789,7 @@
</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -786,7 +809,7 @@
<jdbc.url>jdbc:sybase:Tds:vmg07.mw.lab.eng.bos.redhat.com:5000/searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
13 years, 7 months
Hibernate SVN: r20238 - search/trunk/hibernate-search/src/main/docbook/en-US/modules.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-08-24 04:26:18 -0400 (Tue, 24 Aug 2010)
New Revision: 20238
Removed:
search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml~
Log:
removed committed backup file
Deleted: search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml~
===================================================================
--- search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml~ 2010-08-23 21:04:17 UTC (rev 20237)
+++ search/trunk/hibernate-search/src/main/docbook/en-US/modules/configuration.xml~ 2010-08-24 08:26:18 UTC (rev 20238)
@@ -1,1187 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Hibernate, Relational Persistence for Idiomatic Java
- ~
- ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- ~ indicated by the @author tags or express copyright attribution
- ~ statements applied by the authors. All third-party contributions are
- ~ distributed under license by Red Hat Middleware LLC.
- ~
- ~ This copyrighted material is made available to anyone wishing to use, modify,
- ~ copy, or redistribute it subject to the terms and conditions of the GNU
- ~ Lesser General Public License, as published by the Free Software Foundation.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- ~ for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this distribution; if not, write to:
- ~ Free Software Foundation, Inc.
- ~ 51 Franklin Street, Fifth Floor
- ~ Boston, MA 02110-1301 USA
- -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="search-configuration">
- <!-- $Id$ -->
-
- <title>Configuration</title>
-
- <section id="search-configuration-directory" revision="1">
- <title>Directory configuration</title>
-
- <para>Apache Lucene has a notion of <literal>Directory</literal> to store
- the index files. The <classname>Directory</classname> implementation can
- be customized, but Lucene comes bundled with a file system
- (<literal>FSDirectoryProvider</literal>) and an in memory
- (<literal>RAMDirectoryProvider</literal>) implementation.
- <literal>DirectoryProvider</literal>s are the Hibernate Search abstraction
- around a Lucene <classname>Directory</classname> and handle the
- configuration and the initialization of the underlying Lucene resources.
- <xref linkend="directory-provider-table" /> shows the list of the
- directory providers bundled with Hibernate Search.</para>
-
- <table id="directory-provider-table">
- <title>List of built-in Directory Providers</title>
-
- <tgroup cols="3">
- <thead>
- <row>
- <entry align="center">Class</entry>
-
- <entry align="center">Description</entry>
-
- <entry align="center">Properties</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>org.hibernate.search.store.RAMDirectoryProvider</entry>
-
- <entry>Memory based directory, the directory will be uniquely
- identified (in the same deployment unit) by the
- <literal>@Indexed.index</literal> element</entry>
-
- <entry>none</entry>
- </row>
-
- <row>
- <entry>org.hibernate.search.store.FSDirectoryProvider</entry>
-
- <entry>File system based directory. The directory used will be
- <indexBase>/< indexName ></entry>
-
- <entry><para><literal>indexBase</literal> : Base
- directory</para><para><literal>indexName</literal>: override
- @Indexed.index (useful for sharded indexes)</para><para><literal>
- locking_strategy</literal> : optional, see <xref
- linkend="search-configuration-directory-lockfactories" />
- </para></entry>
- </row>
-
- <row>
- <entry>org.hibernate.search.store.FSMasterDirectoryProvider</entry>
-
- <entry><para>File system based directory. Like
- FSDirectoryProvider. It also copies the index to a source
- directory (aka copy directory) on a regular basis.
- </para><para>The recommended value for the refresh period is (at
- least) 50% higher that the time to copy the information (default
- 3600 seconds - 60 minutes).</para><para>Note that the copy is
- based on an incremental copy mechanism reducing the average copy
- time.</para><para>DirectoryProvider typically used on the master
- node in a JMS back end cluster.</para><para>The <literal>
- buffer_size_on_copy</literal> optimum depends on your operating
- system and available RAM; most people reported good results using
- values between 16 and 64MB.</para></entry>
-
- <entry><para><literal>indexBase</literal>: Base
- directory</para><para><literal>indexName</literal>: override
- @Indexed.index (useful for sharded
- indexes)</para><para><literal>sourceBase</literal>: Source (copy)
- base directory.</para><para><literal>source</literal>: Source
- directory suffix (default to <literal>@Indexed.index</literal>).
- The actual source directory name being
- <filename><sourceBase>/<source></filename>
- </para><para><literal>refresh</literal>: refresh period in second
- (the copy will take place every refresh seconds).</para><para>
- <literal>buffer_size_on_copy</literal>: The amount of MegaBytes to
- move in a single low level copy instruction; defaults to
- 16MB.</para><para><literal> locking_strategy</literal> : optional,
- see <xref
- linkend="search-configuration-directory-lockfactories" />
- </para></entry>
- </row>
-
- <row>
- <entry>org.hibernate.search.store.FSSlaveDirectoryProvider</entry>
-
- <entry><para>File system based directory. Like
- FSDirectoryProvider, but retrieves a master version (source) on a
- regular basis. To avoid locking and inconsistent search results, 2
- local copies are kept. </para><para>The recommended value for the
- refresh period is (at least) 50% higher that the time to copy the
- information (default 3600 seconds - 60 minutes).</para><para>Note
- that the copy is based on an incremental copy mechanism reducing
- the average copy time.</para><para>DirectoryProvider typically
- used on slave nodes using a JMS back end.</para><para>The
- <literal> buffer_size_on_copy</literal> optimum depends on your
- operating system and available RAM; most people reported good
- results using values between 16 and 64MB.</para></entry>
-
- <entry><para><literal>indexBase</literal>: Base
- directory</para><para><literal>indexName</literal>: override
- @Indexed.index (useful for sharded
- indexes)</para><para><literal>sourceBase</literal>: Source (copy)
- base directory.</para><para><literal>source</literal>: Source
- directory suffix (default to <literal>@Indexed.index</literal>).
- The actual source directory name being
- <filename><sourceBase>/<source></filename>
- </para><para><literal>refresh</literal>: refresh period in second
- (the copy will take place every refresh seconds).</para><para>
- <literal>buffer_size_on_copy</literal>: The amount of MegaBytes to
- move in a single low level copy instruction; defaults to
- 16MB.</para><para><literal> locking_strategy</literal> : optional,
- see <xref
- linkend="search-configuration-directory-lockfactories" />
- </para></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <para>If the built-in directory providers do not fit your needs, you can
- write your own directory provider by implementing the
- <classname>org.hibernate.store.DirectoryProvider</classname>
- interface.</para>
-
- <para>Each indexed entity is associated to a Lucene index (an index can be
- shared by several entities but this is not usually the case). You can
- configure the index through properties prefixed by
- <constant>hibernate.search.</constant><replaceable>indexname</replaceable>
- . Default properties inherited to all indexes can be defined using the
- prefix <constant>hibernate.search.default.</constant></para>
-
- <para>To define the directory provider of a given index, you use the
- <constant>hibernate.search.<replaceable>indexname</replaceable>.directory_provider
- </constant></para>
-
- <example>
- <title>Configuring directory providers</title>
-
- <programlisting>hibernate.search.default.directory_provider org.hibernate.search.store.FSDirectoryProvider
-hibernate.search.default.indexBase=/usr/lucene/indexes
-hibernate.search.Rules.directory_provider org.hibernate.search.store.RAMDirectoryProvider</programlisting>
- </example>
-
- <para>applied on</para>
-
- <example>
- <title>Specifying the index name using the <literal>index</literal>
- parameter of <classname>@Indexed</classname></title>
-
- <programlisting>@Indexed(index="Status")
-public class Status { ... }
-
-@Indexed(index="Rules")
-public class Rule { ... }</programlisting>
- </example>
-
- <para>will create a file system directory in
- <filename>/usr/lucene/indexes/Status</filename> where the Status entities
- will be indexed, and use an in memory directory named
- <literal>Rules</literal> where Rule entities will be indexed.</para>
-
- <para>You can easily define common rules like the directory provider and
- base directory, and override those defaults later on on a per index
- basis.</para>
-
- <para>Writing your own <classname>DirectoryProvider</classname>, you can
- utilize this configuration mechanism as well.</para>
- </section>
-
- <section id="search-configuration-directory-sharding" revision="1">
- <title>Sharding indexes</title>
-
- <para>In some cases, it is necessary to split (shard) the indexing data of
- a given entity type into several Lucene indexes. This solution is not
- recommended unless there is a pressing need because by default, searches
- will be slower as all shards have to be opened for a single search. In
- other words don't do it until you have problems :)</para>
-
- <para>For example, sharding may be desirable if:</para>
-
- <itemizedlist>
- <listitem>
- <para>A single index is so huge that index update times are slowing
- the application down.</para>
- </listitem>
-
- <listitem>
- <para>A typical search will only hit a sub-set of the index, such as
- when data is naturally segmented by customer, region or
- application.</para>
- </listitem>
- </itemizedlist>
-
- <para>Hibernate Search allows you to index a given entity type into
- several sub indexes. Data is sharded into the different sub indexes thanks
- to an <classname>IndexShardingStrategy</classname>. By default, no
- sharding strategy is enabled, unless the number of shards is configured.
- To configure the number of shards use the following property</para>
-
- <example>
- <title>Enabling index sharding by specifying nbr_of_shards for a
- specific index</title>
-
- <programlisting>hibernate.search.<indexName>.sharding_strategy.nbr_of_shards 5</programlisting>
- </example>
-
- <para>This will use 5 different shards.</para>
-
- <para>The default sharding strategy, when shards are set up, splits the
- data according to the hash value of the id string representation
- (generated by the Field Bridge). This ensures a fairly balanced sharding.
- You can replace the strategy by implementing
- <literal>IndexShardingStrategy</literal> and by setting the following
- property</para>
-
- <example>
- <title>Specifying a custom sharding strategy</title>
-
- <programlisting>hibernate.search.<indexName>.sharding_strategy my.shardingstrategy.Implementation</programlisting>
- </example>
-
- <para>Using a custom <classname>IndexShardingStrategy</classname>
- implementation, it's possible to define what shard a given entity is
- indexed to.</para>
-
- <para>It also allows for optimizing searches by selecting which shard to
- run the query onto. By activating a filter (see <xref
- linkend="query-filter-shard" />), a sharding strategy can select a subset
- of the shards used to answer a query
- (<classname>IndexShardingStrategy.getDirectoryProvidersForQuery</classname>)
- and thus speed up the query execution.</para>
-
- <para>Each shard has an independent directory provider configuration as
- described in <xref linkend="search-configuration-directory" />. The
- <classname>DirectoryProvider</classname> default name for the previous
- example are <literal><indexName>.0</literal> to
- <literal><indexName>.4</literal>. In other words, each shard has the
- name of it's owning index followed by <constant>.</constant> (dot) and its
- index number.</para>
-
- <example>
- <title>Configuring the sharding configuration for an example entity
- <classname>Animal</classname></title>
-
- <programlisting>hibernate.search.default.indexBase /usr/lucene/indexes
-
-hibernate.search.Animal.sharding_strategy.nbr_of_shards 5
-hibernate.search.Animal.directory_provider org.hibernate.search.store.FSDirectoryProvider
-hibernate.search.Animal.0.indexName Animal00
-hibernate.search.Animal.3.indexBase /usr/lucene/sharded
-hibernate.search.Animal.3.indexName Animal03</programlisting>
- </example>
-
- <para>This configuration uses the default id string hashing strategy and
- shards the Animal index into 5 subindexes. All subindexes are
- <classname>FSDirectoryProvider</classname> instances and the directory
- where each subindex is stored is as followed:</para>
-
- <itemizedlist>
- <listitem>
- <para>for subindex 0: /usr/lucene/indexes/Animal00 (shared indexBase
- but overridden indexName)</para>
- </listitem>
-
- <listitem>
- <para>for subindex 1: /usr/lucene/indexes/Animal.1 (shared indexBase,
- default indexName)</para>
- </listitem>
-
- <listitem>
- <para>for subindex 2: /usr/lucene/indexes/Animal.2 (shared indexBase,
- default indexName)</para>
- </listitem>
-
- <listitem>
- <para>for subindex 3: /usr/lucene/shared/Animal03 (overridden
- indexBase, overridden indexName)</para>
- </listitem>
-
- <listitem>
- <para>for subindex 4: /usr/lucene/indexes/Animal.4 (shared indexBase,
- default indexName)</para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>Sharing indexes (two entities into the same directory)</title>
-
- <note>
- <para>This is only presented here so that you know the option is
- available. There is really not much benefit in sharing indexes.</para>
- </note>
-
- <para>It is technically possible to store the information of more than one
- entity into a single Lucene index. There are two ways to accomplish
- this:</para>
-
- <itemizedlist>
- <listitem>
- <para>Configuring the underlying directory providers to point to the
- same physical index directory. In practice, you set the property
- <literal>hibernate.search.[fully qualified entity
- name].indexName</literal> to the same value. As an example let’s use
- the same index (directory) for the <classname>Furniture</classname>
- and <classname>Animal</classname> entity. We just set
- <literal>indexName</literal> for both entities to for example
- “Animal”. Both entities will then be stored in the Animal
- directory</para>
-
- <para><programlisting><code>hibernate.search.org.hibernate.search.test.shards.Furniture.indexName = Animal
-hibernate.search.org.hibernate.search.test.shards.Animal.indexName = Animal</code></programlisting></para>
- </listitem>
-
- <listitem>
- <para>Setting the <code>@Indexed</code> annotation’s
- <methodname>index</methodname> attribute of the entities you want to
- merge to the same value. If we again wanted all
- <classname>Furniture</classname> instances to be indexed in the
- <classname>Animal</classname> index along with all instances of
- <classname>Animal</classname> we would specify
- <code>@Indexed(index=”Animal”)</code> on both
- <classname>Animal</classname> and <classname>Furniture</classname>
- classes.</para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>Worker configuration</title>
-
- <para>It is possible to refine how Hibernate Search interacts with Lucene
- through the worker configuration. The work can be executed to the Lucene
- directory or sent to a JMS queue for later processing. When processed to
- the Lucene directory, the work can be processed synchronously or
- asynchronously to the transaction commit.</para>
-
- <para>You can define the worker configuration using the following
- properties</para>
-
- <table>
- <title>worker configuration</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>Property</entry>
-
- <entry>Description</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.backend</literal></entry>
-
- <entry>Out of the box support for the Apache Lucene back end and
- the JMS back end. Default to <literal>lucene</literal>. Supports
- also <literal>jms</literal>, <literal>blackhole</literal>,
- <literal>jgroupsMaster</literal> and
- <literal>jgroupsSlave</literal>.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.execution</literal></entry>
-
- <entry>Supports synchronous and asynchronous execution. Default to
- <literal><literal>sync</literal></literal>. Supports also
- <literal>async</literal>.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.thread_pool.size</literal></entry>
-
- <entry>Defines the number of threads in the pool. useful only for
- asynchronous execution. Default to 1.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.buffer_queue.max</literal></entry>
-
- <entry>Defines the maximal number of work queue if the thread poll
- is starved. Useful only for asynchronous execution. Default to
- infinite. If the limit is reached, the work is done by the main
- thread.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.jndi.*</literal></entry>
-
- <entry>Defines the JNDI properties to initiate the InitialContext
- (if needed). JNDI is only used by the JMS back end.</entry>
- </row>
-
- <row>
- <entry><literal>
- hibernate.search.worker.jms.connection_factory</literal></entry>
-
- <entry>Mandatory for the JMS back end. Defines the JNDI name to
- lookup the JMS connection factory from
- (<literal>/ConnectionFactory</literal> by default in JBoss
- AS)</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.jms.queue</literal></entry>
-
- <entry>Mandatory for the JMS back end. Defines the JNDI name to
- lookup the JMS queue from. The queue will be used to post work
- messages.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.jgroups.clusterName</literal></entry>
-
- <entry>Optional for JGroups back end. Defines the name of JGroups
- channel.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.jgroups.configurationFile</literal></entry>
-
- <entry>Optional JGroups network stack configuration. Defines the
- name of a JGroups configuration file, which must exist on
- classpath.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.jgroups.configurationXml</literal></entry>
-
- <entry>Optional JGroups network stack configuration. Defines a
- String representing JGroups configuration as XML.</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.worker.jgroups.configurationString</literal></entry>
-
- <entry>Optional JGroups network stack configuration. Provides
- JGroups configuration in plain text.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-
- <section id="jms-backend">
- <title>JMS Master/Slave configuration</title>
-
- <para>This section describes in greater detail how to configure the Master
- / Slaves Hibernate Search architecture.</para>
-
- <mediaobject>
- <imageobject role="html">
- <imagedata align="center" fileref="jms-backend.png" format="PNG" />
- </imageobject>
-
- <imageobject role="fo">
- <imagedata align="center" depth="" fileref="jms-backend.png"
- format="PNG" scalefit="1" width="12cm" />
- </imageobject>
-
- <caption><para>JMS back end configuration.</para></caption>
- </mediaobject>
-
- <section>
- <title>Slave nodes</title>
-
- <para>Every index update operation is sent to a JMS queue. Index
- querying operations are executed on a local index copy.</para>
-
- <example>
- <title>JMS Slave configuration</title>
-
- <programlisting>### slave configuration
-
-## DirectoryProvider
-# (remote) master location
-hibernate.search.default.sourceBase = /mnt/mastervolume/lucenedirs/mastercopy
-
-# local copy location
-hibernate.search.default.indexBase = /Users/prod/lucenedirs
-
-# refresh every half hour
-hibernate.search.default.refresh = 1800
-
-# appropriate directory provider
-hibernate.search.default.directory_provider = org.hibernate.search.store.FSSlaveDirectoryProvider
-
-## Backend configuration
-hibernate.search.worker.backend = jms
-hibernate.search.worker.jms.connection_factory = /ConnectionFactory
-hibernate.search.worker.jms.queue = queue/hibernatesearch
-#optional jndi configuration (check your JMS provider for more information)
-
-## Optional asynchronous execution strategy
-# hibernate.search.worker.execution = async
-# hibernate.search.worker.thread_pool.size = 2
-# hibernate.search.worker.buffer_queue.max = 50</programlisting>
- </example>
-
- <para>A file system local copy is recommended for faster search
- results.</para>
-
- <para>The refresh period should be higher that the expected time
- copy.</para>
- </section>
-
- <section>
- <title>Master node</title>
-
- <para>Every index update operation is taken from a JMS queue and
- executed. The master index is copied on a regular basis.</para>
-
- <example>
- <title>JMS Master configuration</title>
-
- <programlisting>### master configuration
-
-## DirectoryProvider
-# (remote) master location where information is copied to
-hibernate.search.default.sourceBase = /mnt/mastervolume/lucenedirs/mastercopy
-
-# local master location
-hibernate.search.default.indexBase = /Users/prod/lucenedirs
-
-# refresh every half hour
-hibernate.search.default.refresh = 1800
-
-# appropriate directory provider
-hibernate.search.default.directory_provider = org.hibernate.search.store.FSMasterDirectoryProvider
-
-## Backend configuration
-#Backend is the default lucene one</programlisting>
- </example>
-
- <para>The refresh period should be higher that the expected time
- copy.</para>
-
- <para>In addition to the Hibernate Search framework configuration, a
- Message Driven Bean should be written and set up to process the index
- works queue through JMS.</para>
-
- <example>
- <title>Message Driven Bean processing the indexing queue</title>
-
- <programlisting>@MessageDriven(activationConfig = {
- @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
- @ActivationConfigProperty(propertyName="destination", propertyValue="queue/hibernatesearch"),
- @ActivationConfigProperty(propertyName="DLQMaxResent", propertyValue="1")
- } )
-public class MDBSearchController extends AbstractJMSHibernateSearchController implements MessageListener {
- @PersistenceContext EntityManager em;
-
- //method retrieving the appropriate session
- protected Session getSession() {
- return (Session) em.getDelegate();
- }
-
- //potentially close the session opened in #getSession(), not needed here
- protected void cleanSessionIfNeeded(Session session)
- }
-}</programlisting>
- </example>
-
- <para>This example inherits from the abstract JMS controller class
- available in the Hibernate Search source code and implements a JavaEE 5
- MDB. This implementation is given as an example and, while most likely
- be more complex, can be adjusted to make use of non Java EE Message
- Driven Beans. For more information about the
- <methodname>getSession()</methodname> and
- <methodname>cleanSessionIfNeeded()</methodname>, please check
- <classname>AbstractJMSHibernateSearchController</classname>'s
- javadoc.</para>
- </section>
- </section>
-
- <section id="jgroups-backend">
- <title>JGroups Master/Slave configuration</title>
-
- <para>Describes how to configure JGroups Master/Slave back end.
- Configuration examples illustrated in JMS Master/Slave configuration
- section (<xref linkend="jms-backend" />) also apply here, only a different
- backend needs to be set.</para>
-
- <section>
- <title>Slave nodes</title>
-
- <para>Every index update operation is sent through a JGroups channel to
- the master node. Index querying operations are executed on a local index
- copy.</para>
-
- <example>
- <title>JGroups Slave configuration</title>
-
- <programlisting>
-### slave configuration
-## Backend configuration
-hibernate.search.worker.backend = jgroupsSlave
- </programlisting>
- </example>
- </section>
-
- <section>
- <title>Master node</title>
-
- <para>Every index update operation is taken from a JGroups channel and
- executed. The master index is copied on a regular basis.</para>
-
- <example>
- <title>JGroups Master configuration</title>
-
- <programlisting>
-### master configuration
-## Backend configuration
-hibernate.search.worker.backend = jgroupsMaster
- </programlisting>
- </example>
- </section>
-
- <section>
- <title>JGroups channel configuration</title>
-
- <para>Optionally configuration for JGroups transport protocols (UDP,
- TCP) and channel name can be defined. It can be applied to both master
- and slave nodes. There are several ways to configure JGroups transport
- details. If it is not defined explicity, configuration found in the
- <literal> flush-udp.xml</literal> file is used.</para>
-
- <example>
- <title>JGroups transport protocols configuration</title>
-
- <programlisting>
-## configuration
-#udp.xml file needs to be located in the classpath
-hibernate.search.worker.backend.jgroups.configurationFile = udp.xml
-
-#protocol stack configuration provided in XML format
-hibernate.search.worker.backend.jgroups.configurationXml =
-
-<config xmlns="urn:org:jgroups"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="urn:org:jgroups file:schema/JGroups-2.8.xsd">
-<UDP
-mcast_addr="${jgroups.udp.mcast_addr:228.10.10.10}"
-mcast_port="${jgroups.udp.mcast_port:45588}"
-tos="8"
-thread_naming_pattern="pl"
-thread_pool.enabled="true"
-thread_pool.min_threads="2"
-thread_pool.max_threads="8"
-thread_pool.keep_alive_time="5000"
-thread_pool.queue_enabled="false"
-thread_pool.queue_max_size="100"
-thread_pool.rejection_policy="Run"/>
-<PING timeout="1000" num_initial_members="3"/>
-<MERGE2 max_interval="30000" min_interval="10000"/>
-<FD_SOCK/>
-<FD timeout="3000" max_tries="3"/>
-<VERIFY_SUSPECT timeout="1500"/>
-<pbcast.STREAMING_STATE_TRANSFER/>
-<pbcast.FLUSH timeout="0"/>
-</config>
-
-#protocol stack configuration provided in "old style" jgroups format
-hibernate.search.worker.backend.jgroups.configurationString =
-
-UDP(mcast_addr=228.1.2.3;mcast_port=45566;ip_ttl=32):PING(timeout=3000;
-num_initial_members=6):FD(timeout=5000):VERIFY_SUSPECT(timeout=1500):
-pbcast.NAKACK(gc_lag=10;retransmit_timeout=3000):UNICAST(timeout=5000):
-FRAG:pbcast.GMS(join_timeout=3000;shun=false;print_local_addr=true)
-
- </programlisting>
- </example>
-
- <para>Master and slave nodes communicate over JGroups channel that is
- identified by this same name. Name of the channel can be defined
- explicity, if not default <literal>HSearchCluster</literal> is
- used.</para>
-
- <example>
- <title>JGroups channel name configuration</title>
-
- <programlisting>
-## Backend configuration
-hibernate.search.worker.backend.jgroups.clusterName = Hibernate-Search-Cluster
- </programlisting>
- </example>
- </section>
- </section>
-
- <section id="configuration-reader-strategy">
- <title>Reader strategy configuration</title>
-
- <para>The different reader strategies are described in <xref
- linkend="search-architecture-readerstrategy" />. Out of the box strategies
- are:</para>
-
- <itemizedlist>
- <listitem>
- <para><literal>shared</literal>: share index readers across several
- queries. This strategy is the most efficient.</para>
- </listitem>
-
- <listitem>
- <para><literal>not-shared</literal>: create an index reader for each
- individual query</para>
- </listitem>
- </itemizedlist>
-
- <para>The default reader strategy is <literal>shared</literal>. This can
- be adjusted:</para>
-
- <programlisting>hibernate.search.reader.strategy = not-shared</programlisting>
-
- <para>Adding this property switches to the <literal>not-shared</literal>
- strategy.</para>
-
- <para>Or if you have a custom reader strategy:</para>
-
- <programlisting>hibernate.search.reader.strategy = my.corp.myapp.CustomReaderProvider</programlisting>
-
- <para>where <classname>my.corp.myapp.CustomReaderProvider</classname> is
- the custom strategy implementation.</para>
- </section>
-
- <section id="search-configuration-event" revision="2">
- <title>Enabling Hibernate Search and automatic indexing</title>
-
- <section>
- <title>Enabling Hibernate Search</title>
-
- <para>Hibernate Search is enabled out of the box when detected on the
- classpath by Hibernate Core. If, for some reason you need to disable it,
- set <literal>hibernate.search.autoregister_listeners</literal> to false.
- Note that there is no performance penalty when the listeners are enabled
- but no entities are annotated as indexed.</para>
- </section>
-
- <section>
- <title>Automatic indexing</title>
-
- <para>By default, every time an object is inserted, updated or deleted
- through Hibernate, Hibernate Search updates the according Lucene index.
- It is sometimes desirable to disable that features if either your index
- is read-only or if index updates are done in a batch way (see <xref
- linkend="search-batchindex" />).</para>
-
- <para>To disable event based indexing, set</para>
-
- <programlisting>hibernate.search.indexing_strategy = manual</programlisting>
-
- <note>
- <para>In most case, the JMS backend provides the best of both world, a
- lightweight event based system keeps track of all changes in the
- system, and the heavyweight indexing process is done by a separate
- process or machine.</para>
- </note>
- </section>
- </section>
-
- <section id="lucene-indexing-performance" revision="3">
- <title>Tuning Lucene indexing performance</title>
-
- <para>Hibernate Search allows you to tune the Lucene indexing performance
- by specifying a set of parameters which are passed through to underlying
- Lucene <literal>IndexWriter</literal> such as
- <literal>mergeFactor</literal>, <literal>maxMergeDocs</literal> and
- <literal>maxBufferedDocs</literal>. You can specify these parameters
- either as default values applying for all indexes, on a per index basis,
- or even per shard.</para>
-
- <para>There are two sets of parameters allowing for different performance
- settings depending on the use case. During indexing operations triggered
- by database modifications, the parameters are grouped by the
- <literal>transaction</literal> keyword: <programlisting>hibernate.search.[default|<indexname>].indexwriter.transaction.<parameter_name></programlisting>
- When indexing occurs via <literal>FullTextSession.index()</literal> or via
- a <classname>MassIndexer</classname> (see <xref
- linkend="search-batchindex" />), the used properties are those grouped
- under the <literal>batch</literal> keyword: <programlisting>hibernate.search.[default|<indexname>].indexwriter.batch.<parameter_name></programlisting></para>
-
- <para>If no value is set for a <literal>.batch</literal> value in a
- specific shard configuration, Hibernate Search will look at the index
- section, then at the default section: <programlisting>hibernate.search.Animals.2.indexwriter.transaction.max_merge_docs 10
-hibernate.search.Animals.2.indexwriter.transaction.merge_factor 20
-hibernate.search.default.indexwriter.batch.max_merge_docs 100</programlisting>
- This configuration will result in these settings applied to the second
- shard of Animals index:</para>
-
- <itemizedlist>
- <listitem>
- <para><literal>transaction.max_merge_docs</literal> = 10</para>
- </listitem>
-
- <listitem>
- <para><literal>batch.max_merge_docs</literal> = 100</para>
- </listitem>
-
- <listitem>
- <para><literal>transaction.merge_factor</literal> = 20</para>
- </listitem>
-
- <listitem>
- <para><literal>batch.merge_factor</literal> = Lucene default</para>
- </listitem>
- </itemizedlist>
-
- <para>All other values will use the defaults defined in Lucene.</para>
-
- <para>The default for all values is to leave them at Lucene's own default,
- so the listed values in the following table actually depend on the version
- of Lucene you are using; values shown are relative to version
- <literal>2.4</literal>. For more information about Lucene indexing
- performances, please refer to the Lucene documentation.</para>
-
- <warning>
- <para>Previous versions had the <literal>batch</literal> parameters
- inherit from <literal>transaction</literal> properties. This needs now
- to be explicitly set.</para>
- </warning>
-
- <table>
- <title>List of indexing performance and behavior properties</title>
-
- <tgroup cols="3">
- <thead>
- <row>
- <entry align="center">Property</entry>
-
- <entry align="center">Description</entry>
-
- <entry align="center">Default Value</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].exclusive_index_use</literal></entry>
-
- <entry><para>Set to <literal>true</literal> when no other process
- will need to write to the same index: this will enable Hibernate
- Search to work in exlusive mode on the index and improve
- performance in writing changes to the index.</para></entry>
-
- <entry><literal>false</literal> (releases locks as soon as
- possible)</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].max_buffered_delete_terms</literal></entry>
-
- <entry><para>Determines the minimal number of delete terms
- required before the buffered in-memory delete terms are applied
- and flushed. If there are documents buffered in memory at the
- time, they are merged and a new segment is created.</para></entry>
-
- <entry>Disabled (flushes by RAM usage)</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].max_buffered_docs</literal></entry>
-
- <entry><para>Controls the amount of documents buffered in memory
- during indexing. The bigger the more RAM is
- consumed.</para></entry>
-
- <entry>Disabled (flushes by RAM usage)</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].max_field_length</literal></entry>
-
- <entry><para>The maximum number of terms that will be indexed for
- a single field. This limits the amount of memory required for
- indexing so that very large data will not crash the indexing
- process by running out of memory. This setting refers to the
- number of running terms, not to the number of different
- terms.</para> <para>This silently truncates large documents,
- excluding from the index all terms that occur further in the
- document. If you know your source documents are large, be sure to
- set this value high enough to accommodate the expected size. If
- you set it to Integer.MAX_VALUE, then the only limit is your
- memory, but you should anticipate an OutOfMemoryError. </para>
- <para>If setting this value in <literal>batch</literal>
- differently than in <literal>transaction</literal> you may get
- different data (and results) in your index depending on the
- indexing mode.</para></entry>
-
- <entry>10000</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].max_merge_docs</literal></entry>
-
- <entry><para>Defines the largest number of documents allowed in a
- segment. Larger values are best for batched indexing and speedier
- searches. Small values are best for transaction
- indexing.</para></entry>
-
- <entry>Unlimited (Integer.MAX_VALUE)</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].merge_factor</literal></entry>
-
- <entry><para>Controls segment merge frequency and size. </para>
- <para>Determines how often segment indexes are merged when
- insertion occurs. With smaller values, less RAM is used while
- indexing, and searches on unoptimized indexes are faster, but
- indexing speed is slower. With larger values, more RAM is used
- during indexing, and while searches on unoptimized indexes are
- slower, indexing is faster. Thus larger values (> 10) are best
- for batch index creation, and smaller values (< 10) for indexes
- that are interactively maintained. The value must no be lower than
- 2.</para></entry>
-
- <entry>10</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].ram_buffer_size</literal></entry>
-
- <entry><para>Controls the amount of RAM in MB dedicated to
- document buffers. When used together max_buffered_docs a flush
- occurs for whichever event happens first.</para> <para>Generally
- for faster indexing performance it's best to flush by RAM usage
- instead of document count and use as large a RAM buffer as you
- can.</para></entry>
-
- <entry>16 MB</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].term_index_interval</literal></entry>
-
- <entry><para>Expert: Set the interval between indexed
- terms.</para> <para>Large values cause less memory to be used by
- IndexReader, but slow random-access to terms. Small values cause
- more memory to be used by an IndexReader, and speed random-access
- to terms. See Lucene documentation for more
- details.</para></entry>
-
- <entry>128</entry>
- </row>
-
- <row>
- <entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].use_compound_file</literal></entry>
-
- <entry>The advantage of using the compound file format is that
- less file descriptors are used. The disadvantage is that indexing
- takes more time and temporary disk space. You can set this
- parameter to <literal>false</literal> in an attempt to improve the
- indexing time, but you could run out of file descriptors if
- <literal>mergeFactor</literal> is also
- large.<para></para><para>Boolean parameter, use
- "<literal>true</literal>" or "<literal>false</literal>". The
- default value for this option is
- <literal>true</literal>.</para></entry>
-
- <entry>true</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <tip>
- <para>When your architecture permits it, always set
- <literal>hibernate.search.default.exclusive_index_use=true</literal> as
- it greatly improves efficiency in index writing.</para>
- </tip>
-
- <para>To tune the indexing speed it might be useful to time the object
- loading from database in isolation from the writes to the index. To
- achieve this set the <literal>blackhole</literal> as worker backend and
- start you indexing routines. This backend does not disable Hibernate
- Search: it will still generate the needed changesets to the index, but
- will discard them instead of flushing them to the index. As opposite to
- setting the <literal>hibernate.search.indexing_strategy</literal> to
- <literal>manual</literal> when using <literal>blackhole</literal> it will
- possibly load more data to rebuild the index from associated
- entities.</para>
-
- <programlisting>hibernate.search.worker.backend blackhole</programlisting>
-
- <para>The recommended approach is to focus first on optimizing the object
- loading, and then use the timings you achieve as a baseline to tune the
- indexing process.</para>
-
- <para>The <literal>blackhole</literal> backend is not meant to be used in
- production, only as a tool to identify indexing bottlenecks.</para>
- </section>
-
- <section id="search-configuration-directory-lockfactories" revision="1">
-
-
- <title>LockFactory configuration</title>
-
-
-
- <para>Lucene Directories have default locking strategies which work well
- for most cases, but it's possible to specify for each index managed by
- Hibernate Search which LockingFactory you want to use.</para>
-
-
-
- <para>Some of these locking strategies require a filesystem level lock and
- may be used even on RAM based indexes, but this is not recommended and of
- no practical use.</para>
-
-
-
- <para>To select a locking factory, set the
- <literal>hibernate.search.<index>.locking_strategy</literal> option
- to one of <literal>simple</literal>, <literal>native</literal>,
- <literal>single</literal> or <literal>none</literal>, or set it to the
- fully qualified name of an implementation of
- <literal>org.hibernate.search.store.LockFactoryFactory</literal>;
- Implementing this interface you can provide a custom
- <literal>org.apache.lucene.store.LockFactory</literal>. <table
- id="search-configuration-directory-lockfactories-table">
- <title>List of available LockFactory implementations</title>
-
- <tgroup cols="3">
- <thead>
- <row>
- <entry align="center">name</entry>
-
- <entry align="center">Class</entry>
-
- <entry align="center">Description</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>simple</entry>
-
- <entry>org.apache.lucene.store.SimpleFSLockFactory</entry>
-
- <entry>
- <para>Safe implementation based on Java's File API, it marks
- the usage of the index by creating a marker file.</para>
-
- <para>If for some reason you had to kill your application, you
- will need to remove this file before restarting it.</para>
-
- <para>This is the default implementation for
- <literal>FSDirectoryProvider</literal>,<literal>FSMasterDirectoryProvider</literal>
- and <literal>FSSlaveDirectoryProvider</literal>.</para>
- </entry>
- </row>
-
- <row>
- <entry>native</entry>
-
- <entry>org.apache.lucene.store.NativeFSLockFactory</entry>
-
- <entry>
- <para>As does <literal>simple</literal> this also marks the
- usage of the index by creating a marker file, but this one is
- using native OS file locks so that even if your application
- crashes the locks will be cleaned up.</para>
-
- <para>This implementation has known problems on NFS.</para>
- </entry>
- </row>
-
- <row>
- <entry>single</entry>
-
- <entry>org.apache.lucene.store.SingleInstanceLockFactory</entry>
-
- <entry>
- <para>This LockFactory doesn't use a file marker but is a Java
- object lock held in memory; therefore it's possible to use it
- only when you are sure the index is not going to be shared by
- any other process.</para>
-
- <para>This is the default implementation for
- <literal>RAMDirectoryProvider</literal>.</para>
- </entry>
- </row>
-
- <row>
- <entry>none</entry>
-
- <entry>org.apache.lucene.store.NoLockFactory</entry>
-
- <entry>
- <para>All changes to this index are not coordinated by any
- lock; test your application carefully and make sure you know
- what it means.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table></para>
-
- Configuration example:
-
- <programlisting>hibernate.search.default.locking_strategy simple
-hibernate.search.Animals.locking_strategy native
-hibernate.search.Books.locking_strategy org.custom.components.MyLockingFactory</programlisting>
-
-
-
- <para />
-
-
- </section>
-
- <section>
- <title>Exception Handling Configuration</title>
-
- <para>Hibernate Search allows you to configure how exceptions are handled
- during the indexing process. If no configuration is provided then
- exceptions are logged to the log output by default. It is possible to
- explicitly declare the exception logging mechanism as seen below:</para>
-
- <para><programlisting>hibernate.search.error_handler log</programlisting>
- The default exception handling occurs for both synchronous and
- asynchronous indexing. Hibernate Search provides an easy mechanism to
- override the default error handling implementation.</para>
-
- <para>In order to provide your own implementation you must implement the
- <code>ErrorHandler</code> interface, which provides <code>handle (
- ErrorContext context )</code> method. The <code>ErrorContext</code>
- provides a reference to the primary <code>LuceneWork</code> that failed,
- the underlying exception and any subsequent <code>LuceneWork</code> that
- could not be processed due to the primary exception.</para>
-
- <para><programlisting>public interface ErrorContext {
- List<LuceneWork> getFailingOperations();
- LuceneWork getOperationAtFault();
- Throwable getThrowable();
- boolean hasErrors();
-}</programlisting></para>
-
- <para>The following provides an example implementation of
- <code>ErrorHandler</code>:</para>
-
- <para><programlisting>public class CustomErrorHandler implements ErrorHandler {
- public void handle ( ErrorContext context ) {
- ...
- //publish error context to some internal error handling system
- ...
- }
-}</programlisting> To register this error handler with Hibernate Search you
- must declare the <code>CustomErrorHandler</code> fully qualified classname
- in the configuration properties:</para>
-
- <para><programlisting>hibernate.search.error_handler CustomerErrorHandler</programlisting></para>
- </section>
-</chapter>
13 years, 7 months