From: Jussi Koskela Date: Fri, 26 Apr 2019 08:31:36 +0000 (+0300) Subject: Index tokenized lowercase versions of name and types for UI searches X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=4e7fd7de62f57825448d4dcc2636d0b59646a7ef;p=simantics%2Fplatform.git Index tokenized lowercase versions of name and types for UI searches * Added support for different name/label in search parameter selection. * Fixed resource search to form wildcard query separately for each term. * Added utility methods to SearchQuery for lower/uppercasing the query gitlab #291 Change-Id: I141569877abc910387eca8633a1c4462153b034e --- diff --git a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/Queries.java b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/Queries.java index 21a25d7d6..21b32fa1e 100644 --- a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/Queries.java +++ b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/Queries.java @@ -12,6 +12,7 @@ *******************************************************************************/ package org.simantics.db.indexing; +import java.io.IOException; import java.io.Reader; import java.util.HashMap; import java.util.Map; @@ -20,12 +21,14 @@ import java.util.regex.Pattern; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenFilter; +import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.KeywordAnalyzer; import org.apache.lucene.analysis.core.WhitespaceAnalyzer; import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper; import org.apache.lucene.analysis.pattern.PatternReplaceFilter; import org.apache.lucene.analysis.pattern.PatternTokenizer; +import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.util.CharTokenizer; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.queryparser.classic.QueryParser; @@ -34,6 +37,7 @@ import org.apache.lucene.search.Query; import org.apache.lucene.util.AttributeFactory; import org.apache.lucene.util.Version; import org.simantics.databoard.util.ObjectUtils; +import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.utils.datastructures.Pair; public class Queries { @@ -94,14 +98,35 @@ public class Queries { } } + final static class LowercaseFilter extends TokenFilter { + private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); + + public LowercaseFilter(TokenStream in) { + super(in); + } + + @Override + public boolean incrementToken() throws IOException { + if (!input.incrementToken()) return false; + String lowercase = termAtt.toString().toLowerCase(); + termAtt.setEmpty().append(lowercase); + return true; + } + } + static final class TypeStringAnalyzer extends Analyzer { + private boolean lowercase; - @Override - protected TokenStreamComponents createComponents(String fieldName, Reader reader) { + public TypeStringAnalyzer(Boolean lowercase) { + this.lowercase = lowercase; + } + + @Override + protected TokenStreamComponents createComponents(String fieldName, Reader reader) { Tokenizer tokenizer = new PatternTokenizer(reader, Pattern.compile("(([^\\\\ ]|\\\\\\\\|\\\\ )+)( *)"), 1); TokenFilter filter = new PatternReplaceFilter(tokenizer, Pattern.compile("(\\\\(\\\\| ))"), "$2", true); - return new TokenStreamComponents(tokenizer, filter); + return new TokenStreamComponents(tokenizer, lowercase ? new LowercaseFilter(filter) : filter); } } @@ -118,7 +143,9 @@ public class Queries { analyzerPerField.put("Resource", new KeywordAnalyzer()); analyzerPerField.put("GUID", new KeywordAnalyzer()); analyzerPerField.put("Name", new KeywordAnalyzer()); - analyzerPerField.put("Types", new TypeStringAnalyzer()); + analyzerPerField.put("Types", new TypeStringAnalyzer(false)); + analyzerPerField.put(Dependencies.FIELD_NAME_SEARCH, new LowerCaseWhitespaceAnalyzer(Version.LUCENE_4_9)); + analyzerPerField.put(Dependencies.FIELD_TYPES_SEARCH, new TypeStringAnalyzer(true)); PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new LowerCaseWhitespaceAnalyzer(Version.LUCENE_4_9), analyzerPerField); return analyzer; diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java index 60ccf99cb..3ca66ce77 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java @@ -36,13 +36,15 @@ public class Dependencies extends FunctionImpl4 result = new ArrayList(); for (Entry entry : entries) { - result.add(new Object[] { ss.getRandomAccessId(entry.parent), ss.getRandomAccessId(entry.resource), entry.name, entry.types, entry.id }); + result.add(new Object[] { ss.getRandomAccessId(entry.parent), ss.getRandomAccessId(entry.resource), entry.name, entry.types, entry.id, entry.name, entry.types }); } return result; @@ -249,21 +251,21 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic @Override public List> query(RequestProcessor session, String search, String bindingPattern, Object[] constants, int maxResultCount) { - if(!Dependencies.getBindingPattern().equals(bindingPattern)) throw new IllegalArgumentException("DependenciesRelation supports indexing only with 'bfffff'"); + if(!Dependencies.getBindingPattern().equals(bindingPattern)) throw new IllegalArgumentException("DependenciesRelation supports indexing only with 'bfffffff'"); IndexedRelations indexer = session.getService(IndexedRelations.class); return indexer.query(null, search, session, resource, (Resource)constants[0], maxResultCount); } @Override public List queryResources(RequestProcessor session, String search, String bindingPattern, Object[] constants, int maxResultCount) { - if(!Dependencies.getBindingPattern().equals(bindingPattern)) throw new IllegalArgumentException("DependenciesRelation supports indexing only with 'bfffff'"); + if(!Dependencies.getBindingPattern().equals(bindingPattern)) throw new IllegalArgumentException("DependenciesRelation supports indexing only with 'bfffffff'"); IndexedRelations indexer = session.getService(IndexedRelations.class); return indexer.queryResources(null, search, session, resource, (Resource)constants[0], maxResultCount); } @Override public List> list(RequestProcessor session, String bindingPattern, Object[] constants, int maxResultCount) { - if(!Dependencies.getBindingPattern().equals(bindingPattern)) throw new IllegalArgumentException("DependenciesRelation supports indexing only with 'bfffff'"); + if(!Dependencies.getBindingPattern().equals(bindingPattern)) throw new IllegalArgumentException("DependenciesRelation supports indexing only with 'bfffffff'"); IndexedRelations indexer = session.getService(IndexedRelations.class); return indexer.query(null, null, session, resource, (Resource)constants[0], maxResultCount); } @@ -412,7 +414,7 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic if(!entry.isValid(graph)) continue; Resource parent = graph.getPossibleObject(entry.component, L0.PartOf); if (parent != null) { - _additions.add(new Object[] { ss.getRandomAccessId(parent), ss.getRandomAccessId(entry.component), name, types, id != null ? id.indexString() : "" }); + _additions.add(new Object[] { ss.getRandomAccessId(parent), ss.getRandomAccessId(entry.component), name, types, id != null ? id.indexString() : "", name, types}); } else { //System.err.println("resource " + entry.component + ": no parent for entry " + name + " " + types); } @@ -433,7 +435,7 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic if(part != null) { _replacementKeys.add(ss.getRandomAccessId(entry.component)); _replacementObjects.add(new Object[] { ss.getRandomAccessId(part), - ss.getRandomAccessId(entry.component), name, types, id != null ? id.indexString() : "" }); + ss.getRandomAccessId(entry.component), name, types, id != null ? id.indexString() : "", name, types}); } } } @@ -617,7 +619,7 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic ArrayList result = new ArrayList(entries.size()); for (Entry entry : entries) { - result.add(new Object[] { ss.getRandomAccessId(entry.parent), ss.getRandomAccessId(entry.resource), entry.name, entry.types, entry.id }); + result.add(new Object[] { ss.getRandomAccessId(entry.parent), ss.getRandomAccessId(entry.resource), entry.name, entry.types, entry.id, entry.name, entry.types }); } Layer0X L0X = Layer0X.getInstance(graph); diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java index 4eca4e550..24f7f5bd8 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java @@ -13,6 +13,7 @@ package org.simantics.debug.ui; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -23,6 +24,7 @@ import java.util.Set; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -56,6 +58,8 @@ import org.simantics.db.common.request.UniqueRead; import org.simantics.db.common.uri.UnescapedChildMapOfResource; 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.layer0.migration.OntologiesFromLibrary; import org.simantics.db.layer0.variable.Variables.Role; import org.simantics.db.request.Read; @@ -302,13 +306,19 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { } } } else { + String[] terms = pattern.trim().split("\\s+"); + if (terms.length == 0) return; + Resource project = Simantics.peekProjectResource(); if (project != null) { IResourceFilter rf = resourceFilter; String filter = getFilterForResourceFilter(rf); if (!filter.isEmpty()) filter += " AND "; - filter += "Name:" + pattern + "*"; + + filter += Dependencies.FIELD_NAME_SEARCH + ":("; + filter += Arrays.stream(terms).map(term -> "+" + IndexQueries.escape(term.toLowerCase(), false) + "*").collect(Collectors.joining(" ")); + filter +=")"; Layer0 L0 = Layer0.getInstance(graph); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java index ff7a3e14e..cfa02bcd6 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java @@ -7,6 +7,7 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; +import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.db.request.Read; import org.simantics.document.linking.ontology.DocumentLink; import org.simantics.layer0.Layer0; @@ -41,7 +42,7 @@ public class SearchLinksAction implements ActionFactory { }); ISearchService searchService = (ISearchService)PlatformUI.getWorkbench().getService(ISearchService.class); SearchQuery query = new SearchQuery(name); - query.setSearchFlag("Name", "on"); + query.setSearchFlag(Dependencies.FIELD_NAME_SEARCH, "on"); query.setSearchFlag(DocumentLink.URIs.SearchFunction, "on"); searchService.performQuery(query, ISearchService.ResultBrowser.VIEW, true); } catch (DatabaseException e) { diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java index eb4b02591..9f14e3629 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java @@ -14,6 +14,7 @@ import org.simantics.db.common.utils.Logger; 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.genericrelation.Dependencies; import org.simantics.document.linking.ontology.DocumentLink; import org.simantics.document.linking.utils.SourceLinkUtil; import org.simantics.scl.runtime.function.FunctionImpl5; @@ -104,7 +105,7 @@ public class SearchFunction extends FunctionImpl5 processed = new HashSet(); - NameComparator c = new NameComparator(query.getQuery("Name")); + NameComparator c = new NameComparator(query.getQuery(Dependencies.FIELD_NAME_SEARCH)); for (Resource source : results) { // Prevent index corruption from producing duplicate results. diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/SearchFunction.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/SearchFunction.java index 3fc15364d..32d84eb9a 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/SearchFunction.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/SearchFunction.java @@ -27,7 +27,7 @@ public class SearchFunction extends FunctionImpl5> results = Searching.performSearch(graph, Layer0X.getInstance(graph).Dependencies, model, - query.escaped(false).getQuery("Name","Types"), maxResults); + query.escapedWithForcedCase(false, false).getQuery(Dependencies.FIELD_NAME_SEARCH, Dependencies.FIELD_TYPES_SEARCH), maxResults); return generateSearchResults(graph, results); } catch (DatabaseException e) { Logger.defaultLogError(e); diff --git a/bundles/org.simantics.workbench.search/search/header.ftl b/bundles/org.simantics.workbench.search/search/header.ftl index 89ae231bb..a32ef1edc 100644 --- a/bundles/org.simantics.workbench.search/search/header.ftl +++ b/bundles/org.simantics.workbench.search/search/header.ftl @@ -28,7 +28,7 @@
<#list getAllSearchParams() as param> - checked > ${param} + checked > ${param.getLabel()}
diff --git a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java index 8a040223b..ffbfc5f62 100644 --- a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java +++ b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java @@ -19,6 +19,7 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.operation.Layer0X; import org.simantics.scl.runtime.function.FunctionImpl5; @@ -34,7 +35,9 @@ public class DependenciesSearchFunction extends FunctionImpl5> results = Searching.performSearch(graph, - Layer0X.getInstance(graph).Dependencies, model, query.getQuery("Name","Types"), maxResults); + Layer0X.getInstance(graph).Dependencies, model, + query.escapedWithForcedCase(false, false).getQuery(Dependencies.FIELD_NAME_SEARCH, Dependencies.FIELD_TYPES_SEARCH), + maxResults); return Searching.generateDependenciesSearchResult(graph, results); } catch (DatabaseException e) { diff --git a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchData.java b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchData.java index 37f7d63a7..f3783f0a0 100644 --- a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchData.java +++ b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchData.java @@ -2,8 +2,8 @@ package org.simantics.workbench.search; import java.io.File; import java.util.Collection; -import java.util.HashSet; -import java.util.Set; +import java.util.Map; +import java.util.TreeMap; /** @@ -44,11 +44,14 @@ public class SearchData { return searchEngines; } - public Set getAllSearchParams() { - Set params = new HashSet(); - for (SearchEngine engine : searchEngines) - params.addAll(engine.getSupportedParams()); - return params; + public Collection getAllSearchParams() { + Map params = new TreeMap<>(); + for (SearchEngine engine : searchEngines) { + for (SearchParam param : engine.getSupportedParams()) { + params.put(param.getName(), param); + } + } + return params.values(); } public NamedResource getModel() { diff --git a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchEngine.java b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchEngine.java index 0c0c92c22..93fdf105c 100644 --- a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchEngine.java +++ b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchEngine.java @@ -13,7 +13,7 @@ public class SearchEngine { private String id; private String name; private Function5 searchFunction; - private Set supportedParams = new HashSet(); + private Set supportedParams = new HashSet<>(); private boolean enabledByDefault; public SearchEngine(String id, Function5 searchFunction, boolean enabledByDefault) { @@ -48,11 +48,15 @@ public class SearchEngine { return id.hashCode(); } - public void addSupportedParam(String param) { - this.supportedParams.add(param); + public void addSupportedParam(String name) { + addSupportedParam(name, name); } - public Set getSupportedParams() { + public void addSupportedParam(String name, String label) { + this.supportedParams.add(new SearchParam(name, label)); + } + + public Set getSupportedParams() { return supportedParams; } diff --git a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchParam.java b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchParam.java new file mode 100644 index 000000000..b47c1ef8d --- /dev/null +++ b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchParam.java @@ -0,0 +1,19 @@ +package org.simantics.workbench.search; + +public class SearchParam { + private String name; + private String label; + + public SearchParam(String name, String label) { + this.name = name; + this.label = label; + } + + public String getName() { + return name; + } + + public String getLabel() { + return label; + } +} \ No newline at end of file diff --git a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchQuery.java b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchQuery.java index d90a90ee9..1852316b9 100644 --- a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchQuery.java +++ b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/SearchQuery.java @@ -108,6 +108,26 @@ public class SearchQuery { return withOriginalQuery( IndexQueries.escape( originalQuery, escapeWildcards ) ); } + /** + * @param uppercase true for uppercased query, false + * for lowercased query + * @return a clone of this query with the query string in lower or uppercase + */ + public SearchQuery withForcedCase(boolean uppercase) { + return withOriginalQuery(uppercase ? originalQuery.toUpperCase() : originalQuery.toLowerCase()); + } + + /** + * @param uppercase true for uppercased query, + * false for lowercased query + * @param escapeWildcards passed to {@link #escaped(boolean)} + * @return a clone of this query with the query string escaped and in lower or + * uppercase + */ + public SearchQuery escapedWithForcedCase(boolean uppercase, boolean escapeWildcards) { + return withForcedCase(uppercase).escaped(escapeWildcards); + } + public static URL encode(File file, SearchQuery query) throws IOException { URL url = file.toURI().toURL(); String s = url.toString() + "?search=" + URLEncoder.encode(query.getOriginalQuery(), "UTF-8"); diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/BrowserView.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/BrowserView.java index aa96ed13b..01d015de5 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/BrowserView.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/BrowserView.java @@ -21,6 +21,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.ViewPart; import org.simantics.Simantics; import org.simantics.db.Session; +import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.db.layer0.request.ActiveModels; import org.simantics.db.management.ISessionContext; import org.simantics.db.management.ISessionContextChangedListener; @@ -132,8 +133,8 @@ public class BrowserView extends ViewPart { protected void initializeViewContent() { SearchQuery query = new SearchQuery(""); - query.setSearchFlag("Name", "on"); - query.setSearchFlag("Types", "on"); + query.setSearchFlag(Dependencies.FIELD_NAME_SEARCH, "on"); + query.setSearchFlag(Dependencies.FIELD_TYPES_SEARCH, "on"); ISearchService searchService = (ISearchService) PlatformUI.getWorkbench().getService(ISearchService.class); if (searchService != null) searchService.performQuery(query, ResultBrowser.VIEW, false); diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceImpl.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceImpl.java index e0a96ed12..733bebddf 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceImpl.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceImpl.java @@ -45,6 +45,7 @@ import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.Instances; +import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.db.layer0.request.ActiveModels; import org.simantics.db.request.Read; import org.simantics.db.service.SerialisationSupport; @@ -567,8 +568,8 @@ public class SearchServiceImpl implements ISearchService{ @SuppressWarnings("unchecked") SearchEngine engine = new SearchEngine(id,name,(Function5)f, true); { - engine.addSupportedParam("Name"); - engine.addSupportedParam("Types"); + engine.addSupportedParam(Dependencies.FIELD_NAME_SEARCH, "Name"); + engine.addSupportedParam(Dependencies.FIELD_TYPES_SEARCH, "Types"); } searchEngines.add(engine); } @@ -661,8 +662,8 @@ public class SearchServiceImpl implements ISearchService{ @SuppressWarnings("unchecked") SearchEngine engine = new SearchEngine(id,name,(Function5)f, enabled); { - engine.addSupportedParam("Name"); - engine.addSupportedParam("Types"); + engine.addSupportedParam(Dependencies.FIELD_NAME_SEARCH, "Name"); + engine.addSupportedParam(Dependencies.FIELD_TYPES_SEARCH, "Types"); } return engine; } diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchTrim.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchTrim.java index 069e31a07..25aa1d292 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchTrim.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchTrim.java @@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.swt.IFocusService; +import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.utils.ui.BundleUtils; import org.simantics.workbench.search.ISearchService; import org.simantics.workbench.search.SearchQuery; @@ -151,7 +152,7 @@ public class SearchTrim extends Composite { query = filter(query); SearchQuery searchQuery = new SearchQuery(originalInput); - searchQuery.setSearchFlag("Name", "on"); + searchQuery.setSearchFlag(Dependencies.FIELD_NAME_SEARCH, "on"); performQuery(searchQuery, browserType); } @@ -166,7 +167,7 @@ public class SearchTrim extends Composite { return; SearchQuery searchQuery = new SearchQuery(originalInput); - searchQuery.setSearchFlag("Types", "on"); + searchQuery.setSearchFlag(Dependencies.FIELD_TYPES_SEARCH, "on"); performQuery(searchQuery, browserType); } @@ -181,8 +182,8 @@ public class SearchTrim extends Composite { return; SearchQuery searchQuery = new SearchQuery(originalInput); - searchQuery.setSearchFlag("Name", "on"); - searchQuery.setSearchFlag("Types", "on"); + searchQuery.setSearchFlag(Dependencies.FIELD_NAME_SEARCH, "on"); + searchQuery.setSearchFlag(Dependencies.FIELD_TYPES_SEARCH, "on"); performQuery(searchQuery, browserType); }