[hibernate-commits] Hibernate SVN: r11266 - in branches/Branch_3_2/HibernateExt/search: src/java/org/hibernate/search/backend/impl and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Mar 9 12:08:56 EST 2007


Author: epbernard
Date: 2007-03-09 12:08:56 -0500 (Fri, 09 Mar 2007)
New Revision: 11266

Modified:
   branches/Branch_3_2/HibernateExt/search/doc/reference/en/modules/architecture.xml
   branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
   branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java
Log:
minor and doc

Modified: branches/Branch_3_2/HibernateExt/search/doc/reference/en/modules/architecture.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/search/doc/reference/en/modules/architecture.xml	2007-03-09 16:28:58 UTC (rev 11265)
+++ branches/Branch_3_2/HibernateExt/search/doc/reference/en/modules/architecture.xml	2007-03-09 17:08:56 UTC (rev 11266)
@@ -19,7 +19,9 @@
   <para><productname>Hibernate Search</productname> can also use a Lucene
   index to search an entity and return a (list of) managed entity saving you
   from the tedious Object / Lucene Document mapping and low level Lucene APIs.
-  The application code use the unified
+  The same persistence context is shared between Hibernate and Hibernate
+  Search ; as a matter of fact, the Seearch Session is built on top of the
+  Hibernate Session. The application code use the unified
   <classname>org.hibernate.Query</classname> API exactly the way a HQL or
   native query would be done.</para>
 

Modified: branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
===================================================================
--- branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java	2007-03-09 16:28:58 UTC (rev 11265)
+++ branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java	2007-03-09 17:08:56 UTC (rev 11266)
@@ -89,7 +89,14 @@
 	public void add(Work work, List<Work> queue) {
 		//TODO optimize by getting rid of dupe works
 		if ( work instanceof UpdateWork ) {
-			//split in 2 to optimize the process (reader first, writer next
+			//split in 2 to optimize the process (reader first, writer next)
+			/**
+			 * even with Lucene 2.1, use of indexWriter to update is not an option
+			 * We can only delete by term, and the index doesn't have a term that
+			 * uniquely identify the entry.
+			 * But essentially the optimization we are doing is the same Lucene is doing, the only extra cost is the
+			 * double file opening.
+			 */
 			queue.add( new DeleteWork( work.getId(), work.getEntity() ) );
 			queue.add( new AddWork( work.getId(), work.getEntity(), work.getDocument() ) );
 		}

Modified: branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java
===================================================================
--- branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java	2007-03-09 16:28:58 UTC (rev 11265)
+++ branches/Branch_3_2/HibernateExt/search/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java	2007-03-09 17:08:56 UTC (rev 11266)
@@ -68,6 +68,11 @@
 	}
 
 	public void performWork(UpdateWork work) {
+		/**
+		 * even with Lucene 2.1, use of indexWriter to update is not an option
+		 * We can only delete by term, and the index doesn't have a term that
+		 * uniquely identify the entry.
+		 */
 		Class entity = work.getEntity();
 		Serializable id = work.getId();
 		Document document = work.getDocument();
@@ -82,6 +87,11 @@
 	}
 
 	private void remove(Class entity, Serializable id) {
+		/**
+		 * even with Lucene 2.1, use of indexWriter to delte is not an option
+		 * We can only delete by term, and the index doesn't have a termt that
+		 * uniquely identify the entry. See logic below
+		 */
 		log.trace( "remove from Lucene index: " + entity + "#" + id );
 		DocumentBuilder builder = workspace.getDocumentBuilder( entity );
 		Term term = builder.getTerm( id );




More information about the hibernate-commits mailing list