浏览代码

HUE-5032 [editor] Improve navigator search facet matching

- Match facet names better
- Match values in facets i.e. 'foo' could match 'tags:foo'
Johan Ahlen 9 年之前
父节点
当前提交
dac2722f7d
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      desktop/core/src/desktop/templates/assist.mako

+ 9 - 1
desktop/core/src/desktop/templates/assist.mako

@@ -1322,7 +1322,15 @@ from metadata.conf import has_navigator
               } else {
                 if (typeof data.facets !== 'undefined') {
                   Object.keys(data.facets).forEach(function (facet) {
-                    values.push({ data: { label: facet + ':', icon: facetIcons[facet], description: Object.keys(data.facets[facet]).join(', ') }, value: beforePartial + facet + ':'});
+                    if (partial.length > 0 && facet.indexOf(partial) !== -1) {
+                      values.push({ data: { label: facet + ':', icon: facetIcons[facet], description: Object.keys(data.facets[facet]).join(', ') }, value: beforePartial + facet + ':'});
+                    } else if (partial.length > 0) {
+                      Object.keys(data.facets[facet]).forEach(function (facetValue) {
+                        if (facetValue.indexOf(partial) !== -1) {
+                          values.push({ data: { label: facet + ':' + facetValue, icon: facetIcons[facet], description: facetValue }, value: beforePartial + facet + ':' + facetValue });
+                        }
+                      });
+                    }
                   });
                 }
                 if (values.length > 0) {