fix logic in search.views
@@ -107,9 +107,10 @@ def elastic_search(request, project_slug=None):
if results:
# sorting inner_hits (if present)
+ if user_input.type == 'file':
+
try:
for result in results:
-
inner_hits = result.meta.inner_hits
sections = inner_hits.sections or []
domains = inner_hits.domains or []
@@ -132,11 +133,8 @@ def elastic_search(request, project_slug=None):
)
result.meta.inner_hits = sorted_results
-
- except Exception as e:
- # if the control comes in this block,
- # that implies that there was a PageSearch
- pass
+ except Exception:
+ log.exception('Error while sorting the results (inner_hits).')
log.debug('Search results: %s', pformat(results.to_dict()))
log.debug('Search facets: %s', pformat(results.facets.to_dict()))
