]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcherBase.java
Added new field TypeId to dependency index for exact type searching
[simantics/platform.git] / bundles / org.simantics.db.indexing / src / org / simantics / db / indexing / IndexedRelationsSearcherBase.java
index 9c3f75bf2452b8dfecb61cdc260ea5efe4875516..c2a7befad6e2723304b920dfc3b689c2551506e9 100644 (file)
@@ -340,6 +340,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;
                 }
 
@@ -426,7 +427,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);
@@ -624,7 +625,7 @@ abstract public class IndexedRelationsSearcherBase {
                     mon.subTask("Erasing previous index");
                     if (getLogger().isDebugEnabled())
                         getLogger().debug("Erasing previous index {}", indexPath.toAbsolutePath());
-                    FileUtils.delete(indexPath);
+                    FileUtils.emptyDirectory(indexPath);
                 }
             }
     
@@ -997,9 +998,9 @@ abstract public class IndexedRelationsSearcherBase {
     }
 
     boolean isIndexAvailable() {
-        return (Files.exists(indexPath) && Files.isDirectory(indexPath));
+        return Files.isDirectory(indexPath);
     }
-    
+
     abstract Throwable bestEffortClear(IProgressMonitor monitor, Session session);
 
     /*