]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed index query regression in L0.Entity instance queries 33/1433/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 8 Feb 2018 21:14:16 +0000 (23:14 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 8 Feb 2018 21:14:16 +0000 (23:14 +0200)
L0.Entity queries no longer returned any results after the changes done
in #7415.

refs #7753

Change-Id: I7f24b200b410606f93b5f8be7dd0c50de4fd7097

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java

index 2347fa99e5c0e7331b3fbd12d04f3705371af52e..07ddce7bd176e1fe2d8eca40819a0183ca3b64bf 100644 (file)
@@ -114,13 +114,14 @@ public class EntityInstances implements Instances {
         private String constructLuceneQuery(ReadGraph graph, Resource type, String filter) throws DatabaseException {
             Layer0 L0 = Layer0.getInstance(graph);
             StringBuilder sb = new StringBuilder();
-            if (!L0.Entity.equals(type)) {
+            boolean emptyFilter = filter.isEmpty();
+            if (emptyFilter || !type.equals(L0.Entity)) {
                 String typeName = graph.getPossibleRelatedValue(type, L0.HasName, Bindings.STRING);
                 if (typeName == null || typeName.isEmpty())
                     return null;
-                sb.append("Types:*").append( IndexQueries.escape( typeName, true ) );
+                sb.append("Types:").append( IndexQueries.escape( typeName, true ) );
             }
-            if (filter.length() > 0) {
+            if (!emptyFilter) {
                 if (sb.length() > 0)
                     sb.append(" AND ");
                 sb.append(filter);