Explorar o código

HUE-5135 [metadata] Case insensitive facet value matching

e.g.
type:ViEw
type:VIE
type:vieW
Romain Rigaux %!s(int64=9) %!d(string=hai) anos
pai
achega
bd026a6

+ 3 - 2
desktop/core/src/desktop/templates/assist.mako

@@ -1612,11 +1612,12 @@ from metadata.conf import has_navigator
             query:  request.term + '*',
             successCallback: function (data) {
               var values = [];
+              var facetPartialRe = new RegExp(partial, 'i');
               if (isFacet && typeof data.facets !== 'undefined') { // Is typed facet, e.g. type: type:bla
                 var facetInQuery = facetMatch[1];
                 if (typeof data.facets[facetInQuery] !== 'undefined') {
                   $.map(data.facets[facetInQuery], function (count, value) {
-                    if (partial === '' || value.indexOf(partial) !== -1) {
+                    if (facetPartialRe.test(value)) {
                       values.push({ data: { label: facetInQuery + ':' + value, icon: NAV_FACET_ICON, description: count }, value: beforePartial + value})
                     }
                   });
@@ -1624,7 +1625,7 @@ from metadata.conf import has_navigator
               } else {
                 if (typeof data.facets !== 'undefined') {
                   Object.keys(data.facets).forEach(function (facet) {
-                    if (partial.length === 0 || facet.indexOf(partial) !== -1) {
+                    if (facetPartialRe.test(facet)) {
                       if (Object.keys(data.facets[facet]).length > 0) {
                         values.push({ data: { label: facet + ':', icon: NAV_FACET_ICON, description: Object.keys(data.facets[facet]).join(', ') }, value: beforePartial + facet + ':'});
                       } else { // Potential facet from the list

+ 1 - 1
desktop/libs/metadata/src/metadata/navigator_client.py

@@ -148,7 +148,7 @@ class NavigatorApi(object):
         filterQueries = []
 
       if sources:
-        default_entity_types, entity_types = self._get_types_from_sources(sources)        
+        default_entity_types, entity_types = self._get_types_from_sources(sources)
 
         if 'hive' in sources or 'impala' in sources:
           fq_type = default_entity_types