]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/QueryIndexUtils.java
Improvements to Lucene indexing
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / QueryIndexUtils.java
index 4a066a30c06b817cf186e93eeb2701567d8d6fc7..ed6886abecec8aab22a9dd9e6c0e0d1226b0d64c 100644 (file)
@@ -12,6 +12,7 @@ import org.simantics.db.common.utils.NameUtils;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.adapter.Instances;
 import org.simantics.db.layer0.adapter.impl.EntityInstances.QueryIndex;
+import org.simantics.db.layer0.genericrelation.IndexQueries;
 import org.simantics.db.layer0.util.Layer0Utils;
 import org.simantics.layer0.Layer0;
 import org.simantics.scl.runtime.function.Function1;
@@ -33,7 +34,7 @@ public final class QueryIndexUtils {
     }
     
     public static List<Resource> searchByGUID(ReadGraph graph, Resource indexRoot, String indexString) throws DatabaseException {
-        return searchByQueryShallow(graph, indexRoot, "GUID:" + indexString);
+        return searchByQueryShallow(graph, indexRoot, "GUID:" + IndexQueries.quoteTerm(indexString));
     }
 
     public static List<Resource> searchByQueryShallow(ReadGraph graph, Resource model, String query) throws DatabaseException {
@@ -90,6 +91,6 @@ public final class QueryIndexUtils {
     }
 
     public static List<Resource> searchByTypeAndNameShallow(ReadGraph graph, Resource model, Resource type, String name) throws DatabaseException {
-        return graph.syncRequest(new QueryIndex(model, type, name), TransientCacheListener.<List<Resource>>instance());
+        return graph.syncRequest(new QueryIndex(model, type, IndexQueries.quoteTerm(name)), TransientCacheListener.<List<Resource>>instance());
     }
 }