浏览代码

HUE-7827 [search] Case insensitive term search for the autocomplete

Romain Rigaux 8 年之前
父节点
当前提交
0d09d5a6d2
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      desktop/libs/dashboard/src/dashboard/api.py

+ 2 - 2
desktop/libs/dashboard/src/dashboard/api.py

@@ -252,13 +252,13 @@ def get_terms(request):
     properties = {
       'terms.limit': limit,
       'terms.distrib': str(support_distributed).lower(),
-      # terms.regex
       # lower
       # mincount
       # maxcount
     }
     if analysis['terms']['prefix']:
-      properties['terms.prefix'] = analysis['terms']['prefix']
+      properties['terms.regex'] = '^%(prefix)s.*' % analysis['terms'] # Case insensitive 'terms.prefix'
+      properties['terms.regex.flag'] = 'case_insensitive'
 
     result['terms'] = SolrApi(SOLR_URL.get(), request.user).terms(collection['name'], field, properties)