]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsImpl.java
Fixed regression in IndexedRelationsImpl.replace return value.
[simantics/platform.git] / bundles / org.simantics.db.indexing / src / org / simantics / db / indexing / IndexedRelationsImpl.java
index aaadc4704d487ddbdce71af7e59a78522648657b..bc9247e37818302ce53b3bdbfd5b35f9c406d21d 100644 (file)
@@ -392,13 +392,13 @@ public class IndexedRelationsImpl implements IndexedRelations {
         
         try {
                
+               DatabaseIndexing.markIndexChanged(processor.getSession(), searcher.getIndexPath());
                if(!searcher.startAccess(null, processor.getSession(), true)) {
                 // Could not write index for some reason. Ignore and let the next index query reinitialize the index.
                        return;
                }
                
             searcher.insertIndex(progress.newChild(40), relation, 1, documents);
-            DatabaseIndexing.markIndexChanged(searcher.getIndexPath());
             
         } catch (InvalidResourceReferenceException e) {
             throw new IndexException(e);
@@ -429,13 +429,13 @@ public class IndexedRelationsImpl implements IndexedRelations {
         LockHandle handle = lock(processor, Pair.make(relationResource, input), true);
         try {
                
+            DatabaseIndexing.markIndexChanged(processor.getSession(), searcher.getIndexPath());
                if(!searcher.startAccess(null, processor.getSession(), true)) {
                 // Could not write index for some reason. Ignore and let the next index query reinitialize the index.
                        return;
                }
                
             searcher.removeIndex(progress.newChild(40), relation, processor, key, keyValues);
-            DatabaseIndexing.markIndexChanged(searcher.getIndexPath());
             
         } catch (DatabaseException e) {
             throw new IndexException(e);
@@ -492,13 +492,12 @@ public class IndexedRelationsImpl implements IndexedRelations {
 
         try {
                
+               DatabaseIndexing.markIndexChanged(processor.getSession(), searcher.getIndexPath());
                if(!searcher.startAccess(null, processor.getSession(), true)) {
                 // Could not write index for some reason. Ignore and let the next index query reinitialize the index.
                        return true;
                }
-            didChange = searcher.replaceIndex(progress.newChild(40), key, keyValues, relation, 1, documents);
-            if(didChange)
-               DatabaseIndexing.markIndexChanged(searcher.getIndexPath());
+            didChange |= searcher.replaceIndex(progress.newChild(40), key, keyValues, relation, 1, documents);
             
         } catch (InvalidResourceReferenceException e) {
             throw new IndexException(e);