Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Commits List »

[hibernate-commits] Hibernate SVN: r14949 -
 search/trunk/doc/reference/en/modules.

hibernate-commits

2008-07-17


Author LoginPost Reply
Author: hardy.ferentschik
Date: 2008-07-17 10:47:53 -0400 (Thu, 17 Jul 2008)
New Revision: 14949

Modified:
 search/trunk/doc/reference/en/modules/getting-started.xml
Log:
Reviewed and updated the Getting Started section.

Modified: search/trunk/doc/reference/en/modules/getting-started.xml
===================================================================
--- search/trunk/doc/reference/en/modules/getting-started.xml  2008-07-17 12:37:46 UTC (rev 14948)
+++ search/trunk/doc/reference/en/modules/getting-started.xml  2008-07-17 14:47:53 UTC (rev 14949)
@@(protected) @@
  summary of the books contained in your database.</para>

  <programlisting>
-package exmaple.Book
+package example;
...
@Entity
public class Book {

 @Id
+ @GeneratedValue
 private Integer id;
+
 private String body;
+
 private String summary;
- @ManyToMany private Set&lt;Author&gt; authors = new HashSet&lt;Author&gt;();
- @ManyToOne private Author mainAuthor;
+
+ @ManyToMany
+ private Set&lt;Author&gt; authors = new HashSet&lt;Author&gt;();
+
+ @ManyToOne
+ private Author mainAuthor;
+
 private Date publicationDate;
 
 public Book() {
 }
 
 // standard getters/setters follow here
-...
+ ...
+}
  </programlisting>

  <para>First you have to tell Hibernate Search which
@@(protected) @@
  linkend="projections" /></para>

  <programlisting>
-package exmaple.Book
+package example;
...
@Entity
<emphasis role="bold">@(protected)>
public class Book {

 @Id
+ @GeneratedValue
 <emphasis role="bold">@(protected)>
 private Integer id;
 
@@(protected) @@
 
 <emphasis role="bold">@(protected)>
 private String summary;
- @ManyToMany private Set&lt;Author&gt; authors = new HashSet&lt;Author&gt;();
- @ManyToOne private Author mainAuthor;
+
+ @ManyToMany
+ private Set&lt;Author&gt; authors = new HashSet&lt;Author&gt;();
+
+ @ManyToOne
+ private Author mainAuthor;
+
 private Date publicationDate;
 
 public Book() {
 }
 
 // standard getters/setters follow here
-...
+ ...
+}
 </programlisting>
 </section>

 <section>
  <title>Indexing</title>

-   <para>Hibernate Search will index every entity persisted, updated or
-   removed through Hibernate core transparently for the application. However,
-   the data already present in your database needs to be indexed once to
-   populate the Lucene index. Once you have added the above properties and
-   annotations it is time to trigger an initial batch index of your books.
-   You can achieve this by adding one of the following code examples to your
-   code (see also <xref linkend="search-batchindex" />):</para>
+   <para>Hibernate Search will index transparently every entity persisted,
+   updated or removed through Hibernate Core. However, you have to trigger an
+   inital indexing to populate the Lucene index with the data already present
+   in your database. Once you have added the above properties and annotations
+   it is time to trigger an initial batch index of your books. You can
+   achieve this by using one of the following code snipplets (see also <xref
+   linkend="search-batchindex" />):</para>

  <para>Example using Hibernate Session:</para>

@@(protected) @@
for (Book book : books) {
  fullTextSession.index(book);
}
-tx.commit(); //index are written at commit time    
+tx.commit(); //index is written at commit time    
  </programlisting>

  <para>Example using JPA:</para>
@@(protected) @@
    </listitem>
  </itemizedlist>

-   <para>The following example uses the entity level annotation to apply a
-   English language analyzer which would help you to achieve your goal. The
-   class <classname>EnglishAnalyzer</classname> is a custom class using the
+   <para>Hibernate Search also introduces the notion of analyzer definitions
+   which allow you to manage and reuse analyzers. This infrastructure is
+   supported by the Solr analyzer framework. The following example uses the
+   entity level annotation to apply a English language analyzer which would
+   help you to achieve your goal. The class
+   <classname>EnglishAnalyzer</classname> is a custom class using the
  Snowball English Stemmer from the <ulink
  url="http://lucene.apache.org/java/docs/lucene-sandbox/">Lucene
  Sandbox</ulink>.</para>
@@(protected) @@
 
 @Field(index=Index.TOKENIZED, store=Store.NO)
 private String summary;
- @ManyToMany private Set&lt;Author&gt; authors = new HashSet&lt;Author&gt;();
+
+ @ManyToMany
+ private Set&lt;Author&gt; authors = new HashSet&lt;Author&gt;();
+
 @ManyToOne private Author mainAuthor;
 private Date publicationDate;
 
@@(protected) @@
  Hibernate Search. You should by now have a file system based index and be
  able to search and retrieve a list of managed objects via Hibernate
  Search. The next step is to get more familiar with the overall
-   architecture ((<xref linkend="search-architecture" />)) and explore the
+   architecture (<xref linkend="search-architecture" />) and explore the
  basic features in more detail.</para>

  <para>Two topics which where only briefly touched in this tutorial were

_______________________________________________
hibernate-commits mailing list
hibernate-commits@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-commits
©2008 gg3721.com - Jax Systems, LLC, U.S.A.