Przeglądaj źródła

HUE-5999 [metadata] Use the proper path of the entity in the search autocomplete or selection

Romain Rigaux 8 lat temu
rodzic
commit
411ce1c

+ 2 - 2
desktop/core/src/desktop/templates/assist_search.mako

@@ -200,7 +200,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER
           var showInAssist = function (entry) {
             self.searchInput('');
             self.searchHasFocus(false);
-            var path = entry.parentPath.split('/').concat([entry.originalName]).splice(1);
+            var path = entry.parentPath.split('/').concat([entry.selectionName]).splice(1);
             window.setTimeout(function () {
               huePubSub.publish('sql.context.popover.hide');
               huePubSub.publish('assist.db.highlight', { sourceType: entry.sourceType.toLowerCase(), path: path });
@@ -217,7 +217,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER
             huePubSub.publish('sql.context.popover.show', {
               data: {
                 type: entry.type === 'FIELD' ? 'column' : (entry.type === 'DATABASE' ? 'database' : 'table'),
-                identifierChain: $.map(entry.parentPath.substring(1).split('/'), function (part) { return { name: part } }).concat({ name: entry.originalName })
+                identifierChain: $.map(entry.parentPath.substring(1).split('/'), function (part) { return { name: part } }).concat({ name: entry.selectionName })
               },
               delayedHide: '.result-entry',
               orientation: 'right',

+ 2 - 1
desktop/libs/metadata/src/metadata/navigator_api.py

@@ -258,7 +258,8 @@ def _augment_highlighting(query_s, records):
     if record['hue_name'] and record.get('sourceType', '') != 'S3':
       record['hue_name'] = (record['hue_name'].replace('/', '.') + '.').lstrip('.')
 
-    record['originalName'] = record['hue_name'] + name # Used in autocomplete
+    record['originalName'] = record['hue_name'] + name # Inserted when selected in autocomplete, full path
+    record['selectionName'] = name # Use when hovering / selecting a search result
 
     for term in ts:
       name = _highlight(term, name)

+ 4 - 3
desktop/libs/metadata/src/metadata/navigator_client.py

@@ -146,9 +146,10 @@ class NavigatorApi(object):
 
       for term in search_terms:
         if ':' not in term:
-          if ('sql' in sources or 'hive' in sources or 'impala' in sources) and '.' in term:
-            parent, term = term.rsplit('.', 2)
-            user_filters.append('parentPath:"/%s"' % parent.replace('.', '/'))
+          if ('sql' in sources or 'hive' in sources or 'impala' in sources):
+            if '.' in term:
+              parent, term = term.rsplit('.', 1)
+              user_filters.append('parentPath:"/%s"' % parent.replace('.', '/'))
           query_clauses.append('OR'.join(['(%s:*%s*)' % (field, term) for field in search_fields]))
         else:
           name, val = term.split(':')