[exo-jcr-commits] exo-jcr SVN: r5944 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Mar 22 11:12:39 EDT 2012


Author: nzamosenchuk
Date: 2012-03-22 11:12:39 -0400 (Thu, 22 Mar 2012)
New Revision: 5944

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
Log:
EXOJCR-1748 : ensure index flushed before checking integrity

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java	2012-03-22 14:36:10 UTC (rev 5943)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java	2012-03-22 15:12:39 UTC (rev 5944)
@@ -860,6 +860,14 @@
       }
    }
 
+   void ensureFlushed() throws IOException
+   {
+      if (modeHandler.getMode() == IndexerIoMode.READ_WRITE)
+      {
+         index.flush();
+      }
+   }
+
    /**
     * {@inheritDoc}
     */
@@ -956,6 +964,14 @@
 
       // check relation Persistent Layer -> Index
       // If current workspace is system, then need to invoke reader correspondent to system index
+      ensureFlushed();
+      if (isSystem)
+      {
+         if (getContext().getParentHandler() != null)
+         {
+            ((SearchIndex)getContext().getParentHandler()).ensureFlushed();
+         }
+      }
       IndexReader indexReader = getIndexReader(isSystem);
       try
       {



More information about the exo-jcr-commits mailing list