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/</url>
<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/</url>
<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);
Show replies by date