Przeglądaj źródła

HUE-8871 [frontend] Search with "tag" facet should work with navigator

Johan Ahlen 6 lat temu
rodzic
commit
c7fea1b362

+ 6 - 3
desktop/core/src/desktop/js/ko/components/ko.globalSearch.js

@@ -152,7 +152,7 @@ class GlobalSearch {
         placeHolder: I18n(window.HAS_CATALOG ? 'Search data and saved documents...' : 'Search saved documents...'),
         querySpec: self.querySpec,
         onClear: function () { self.selectedIndex(null); self.searchResultVisible(false); },
-        facets: window.HAS_READ_ONLY_CATALOG ? ['type', 'tag', 'classification'] : ['type', 'tag', 'parentPath', 'originalName'],
+        facets: window.HAS_READ_ONLY_CATALOG ? ['classification', 'tag', 'tags', 'type'] : ['originalName', 'parentPath', 'tag', 'tags', 'type'],
         knownFacetValues: self.knownFacetValues,
         autocompleteFromEntries: self.autocompleteFromEntries,
         triggerObservable: self.searchResultCategories
@@ -339,9 +339,12 @@ class GlobalSearch {
     const self = this;
     dataCatalog.getAllNavigatorTags({ silenceErrors: true }).done(facets => {
       const facetValues = self.knownFacetValues();
-      facetValues['tag'] = facets;
       facetValues['tags'] = facets;
-      facetValues['classification'] = facets;
+      facetValues['tag'] = facets;
+      if (window.HAS_READ_ONLY_CATALOG) {
+        facetValues['classification'] = facets;
+      }
+
     });
   }
 

+ 2 - 0
desktop/libs/metadata/src/metadata/catalog/navigator_client.py

@@ -200,6 +200,8 @@ class NavigatorApi(Api):
       auto_field_facets = ["tags", "type"] + f.keys()
       query_s = (query_s.strip() if query_s else '') + '*'
 
+      query_s = query_s.replace('tag:', 'tags:').replace('classification:', 'tags:')
+
       last_query_term = [term for term in query_s.split()][-1]
 
       if last_query_term and last_query_term != '*':