Kaynağa Gözat

HUE-4942 [metadata] Restrict search by default to tables and views only

Also fix the tests
Romain Rigaux 9 yıl önce
ebeveyn
işleme
71ee364

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

@@ -74,12 +74,12 @@ class NavigatorApi(object):
       TODO: support smarter boolean searching with arbitrary ordering and precedence of conditionals
       TODO: support smarter boolean searching with arbitrary ordering and precedence of conditionals
     """
     """
     search_fields = ('originalName', 'originalDescription', 'name', 'description', 'tags')
     search_fields = ('originalName', 'originalDescription', 'name', 'description', 'tags')
-    entity_types = ('DATABASE', 'TABLE', 'PARTITION', 'FIELD', 'FILE', 'OPERATION')
+    entity_types = ('DATABASE', 'TABLE', 'PARTITION', 'FIELD', 'FILE', 'VIEW', 'OPERATION')
 
 
     sources = filters.get('sources', [])
     sources = filters.get('sources', [])
 
 
     if 'hive' in sources or 'impala' in sources:
     if 'hive' in sources or 'impala' in sources:
-      entity_types = ('DATABASE', 'TABLE', 'PARTITION', 'FIELD')
+      entity_types = ('TABLE', 'VIEW') # 'DATABASE', 'PARTITION', 'FIELD'
 
 
     try:
     try:
       params = self.__params
       params = self.__params

+ 2 - 2
desktop/libs/metadata/src/metadata/navigator_tests.py

@@ -94,7 +94,7 @@ class TestNavigatorApi(object):
     resp = self.client.post(reverse('metadata:delete_tags'), self._format_json_body({'id': entity_id, 'tags': ['hue_test']}))
     resp = self.client.post(reverse('metadata:delete_tags'), self._format_json_body({'id': entity_id, 'tags': ['hue_test']}))
     json_resp = json.loads(resp.content)
     json_resp = json.loads(resp.content)
     assert_equal(0, json_resp['status'], json_resp)
     assert_equal(0, json_resp['status'], json_resp)
-    assert_equal(entity['tags'] , json_resp['entity']['tags'])
+    assert_equal(entity['tags'], json_resp['entity']['tags'])
 
 
 
 
   def test_api_properties(self):
   def test_api_properties(self):
@@ -125,7 +125,7 @@ class TestNavigatorApi(object):
   def test_suggest(self):
   def test_suggest(self):
     resp = self.client.post(reverse('metadata:suggest'), self._format_json_body({'prefix': 'hue'}))
     resp = self.client.post(reverse('metadata:suggest'), self._format_json_body({'prefix': 'hue'}))
     json_resp = json.loads(resp.content)
     json_resp = json.loads(resp.content)
-    assert_true('prefix' in json_resp)
+    assert_true('suggest' in json_resp)
     assert_equal(0, json_resp['status'], json_resp)
     assert_equal(0, json_resp['status'], json_resp)