From bd2e11cd11e6f5caca215c7546e870564d2c80d4 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 8 Feb 2018 23:14:16 +0200 Subject: [PATCH] Fixed index query regression in L0.Entity instance queries L0.Entity queries no longer returned any results after the changes done in #7415. refs #7753 Change-Id: I7f24b200b410606f93b5f8be7dd0c50de4fd7097 --- .../simantics/db/layer0/adapter/impl/EntityInstances.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java index 2347fa99e..07ddce7bd 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java @@ -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); -- 2.47.1