Browse Source

HUE-5231 [search] Avoid error popup when analysing text fields

Romain Rigaux 9 years ago
parent
commit
9403c3526f
2 changed files with 3 additions and 2 deletions
  1. 2 1
      apps/search/src/search/views.py
  2. 1 1
      desktop/libs/libsolr/src/libsolr/api.py

+ 2 - 1
apps/search/src/search/views.py

@@ -424,10 +424,11 @@ def get_stats(request):
     result['message'] = ''
 
   except Exception, e:
+    LOG.exception('Failed to get stats for field')
     result['message'] = force_unicode(e)
     if 'not currently supported' in result['message']:
       result['status'] = 1
-      result['message'] = _('This field does not support stats')
+      result['message'] = _('This field type does not support stats')
 
   return JsonResponse(result)
 

+ 1 - 1
desktop/libs/libsolr/src/libsolr/api.py

@@ -802,7 +802,7 @@ class SolrApi(object):
 
 
   def _get_nested_fields(self, collection):
-    if collection.get('nested') and collection['nested']['enabled']:
+    if collection and collection.get('nested') and collection['nested']['enabled']:
       return [field['filter'] for field in self._flatten_schema(collection['nested']['schema']) if field['selected']]
     else:
       return []