X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fservices%2FCaseInsensitiveComponentFunctionNamingStrategy.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fservices%2FCaseInsensitiveComponentFunctionNamingStrategy.java;h=d5a2b92a42306f466bd4d94a2f00dd4de536e0e8;hp=ad48d1f2f809ab89e48a545da83ae88f26e094ca;hb=0935b78fb5a162719de5dab404b7161de2e7e717;hpb=ca59190923cb45fbcde8d18d78c9c1418c1f0471 diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/services/CaseInsensitiveComponentFunctionNamingStrategy.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/services/CaseInsensitiveComponentFunctionNamingStrategy.java index ad48d1f2f..d5a2b92a4 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/services/CaseInsensitiveComponentFunctionNamingStrategy.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/services/CaseInsensitiveComponentFunctionNamingStrategy.java @@ -27,6 +27,7 @@ import org.simantics.db.common.request.PossibleIndexRoot; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.db.layer0.genericrelation.IndexQueries; import org.simantics.db.service.GraphChangeListenerSupport; import org.simantics.layer0.Layer0; @@ -45,7 +46,7 @@ import gnu.trove.set.hash.THashSet; * *

* The type of the function is expected to be: - * ReadGraph => Resource -> String -> Integer -> List<Map<String,Object>> + * ReadGraph => Resource -> String -> Integer -> List<Resource> * * @author Tuukka Lehtonen * @@ -135,7 +136,7 @@ public class CaseInsensitiveComponentFunctionNamingStrategy extends ComponentNam synchronized (this) { - String search = "Name:" + lowercaseName + "*"; + String search = IndexQueries.escapeTerm(Dependencies.FIELD_NAME_SEARCH, lowercaseName, true) + "*"; //$NON-NLS-1$ @SuppressWarnings("unchecked") List components = (List) index.apply(graph, indexRoot, search, Integer.MAX_VALUE); @@ -227,7 +228,7 @@ public class CaseInsensitiveComponentFunctionNamingStrategy extends ComponentNam synchronized (this) { - String search = "Name:" + proposition + "*"; + String search = Dependencies.FIELD_NAME_SEARCH + ":" + IndexQueries.escape(proposition.toLowerCase(), true) + "*"; //$NON-NLS-1$ //$NON-NLS-2$ Set reserved = graph.syncRequest(new ComponentsRequest(new Tuple4(indexRoot, index, search, getComparator())), TransientCacheAsyncListener.instance()); @@ -267,7 +268,7 @@ public class CaseInsensitiveComponentFunctionNamingStrategy extends ComponentNam if (propositionPreFilter != null) proposition = propositionPreFilter.apply(proposition); - String search = "Name:" + IndexQueries.quoteTerm( proposition ); + String search = IndexQueries.quoteTerm(Dependencies.FIELD_NAME_SEARCH, proposition.toLowerCase()); @SuppressWarnings("unchecked") List components = (List) index.apply(graph, indexRoot, search, Integer.MAX_VALUE);