[hibernate-commits] Hibernate SVN: r16274 - search/trunk/src/main/java/org/hibernate/search/engine.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Apr 7 18:09:50 EDT 2009


Author: sannegrinovero
Date: 2009-04-07 18:09:50 -0400 (Tue, 07 Apr 2009)
New Revision: 16274

Modified:
   search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
Log:
HSEARCH-357 IdBridge being applied on null entity during purgeAll()

Modified: search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java	2009-04-07 21:37:10 UTC (rev 16273)
+++ search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java	2009-04-07 22:09:50 UTC (rev 16274)
@@ -295,28 +295,24 @@
 			return;
 		}
 
-		String idInString = idBridge.objectToString( id );
 		if ( workType == WorkType.ADD ) {
+			String idInString = idBridge.objectToString( id );
 			queue.add( createAddWork( entityClass, entity, id, idInString, false ) );
 		}
 		else if ( workType == WorkType.DELETE || workType == WorkType.PURGE ) {
+			String idInString = idBridge.objectToString( id );
 			queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
 		}
 		else if ( workType == WorkType.PURGE_ALL ) {
 			queue.add( new PurgeAllLuceneWork( entityClass ) );
 		}
 		else if ( workType == WorkType.UPDATE || workType == WorkType.COLLECTION ) {
-			/**
-			 * 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.
-			 */
+			String idInString = idBridge.objectToString( id );
 			queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
 			queue.add( createAddWork( entityClass, entity, id, idInString, false ) );
 		}
 		else if ( workType == WorkType.INDEX ) {
+			String idInString = idBridge.objectToString( id );
 			queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
 			queue.add( createAddWork( entityClass, entity, id, idInString, true ) );
 		}




More information about the hibernate-commits mailing list