]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcherBase.java
Add locking for IndexUtils.flushIndexCaches
[simantics/platform.git] / bundles / org.simantics.db.indexing / src / org / simantics / db / indexing / IndexedRelationsSearcherBase.java
index afcaafd51858229f8ac153c535493c1711717cef..dad5ad07b13ea49011ea03d0d70b5a254c62d32c 100644 (file)
@@ -347,6 +347,7 @@ abstract public class IndexedRelationsSearcherBase {
                     removedTerm = new Term(key, (String) keyValue);
                 } else {
                     // FIXME: should throw an exception for illegal input data but this would leave the index in an incoherent state
+                    getLogger().error("Attempting to remove document from index of {} with key {} and unrecognized key value type {} : {}", input, key, keyValue, keyValue != null ? keyValue.getClass() : "null");
                     continue;
                 }
 
@@ -433,7 +434,7 @@ abstract public class IndexedRelationsSearcherBase {
                     boolean done = false;
                     if(requireChangeInfoOnReplace()) {
                            TopDocs exist = searcher.search(new TermQuery(removedTerm), null, 2);
-                           if(exist.scoreDocs.length == 1 && requireChangeInfoOnReplace()) {
+                           if(exist.scoreDocs.length == 1) {
                                Document doc = reader.document(exist.scoreDocs[0].doc);
                                if(!areSame(doc, document)) {
                                    writer.deleteDocuments(removedTerm);
@@ -504,7 +505,7 @@ abstract public class IndexedRelationsSearcherBase {
      */
     final IndexSchema      schema;
 
-    Resource         input;
+    final Resource         input;
 
     Path             indexPath;
 
@@ -529,6 +530,14 @@ abstract public class IndexedRelationsSearcherBase {
         this.schema = IndexSchema.readFromRelation(session, relation);
     }
 
+    public Resource getRelation() {
+        return relation;
+    }
+
+    public Resource getInput() {
+        return input;
+    }
+
     Directory getDirectory(Session session) throws IOException {
         return FSDirectory.open(indexPath.toFile());
     }