We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f47f05 commit 9fa3fd3Copy full SHA for 9fa3fd3
readthedocs/search/api.py
@@ -62,12 +62,14 @@ def get_inner_hits(self, obj):
62
63
def _get_inner_hits_highlights(self, hit):
64
"""Removes new lines from highlight and log it."""
65
- highlight_dict = utils._remove_newlines_from_dict(
66
- hit.highlight.to_dict()
67
- )
68
-
69
- log.debug('API Search highlight: %s', pformat(highlight_dict))
70
- return highlight_dict
+ if hasattr(hit, 'highlight'):
+ highlight_dict = utils._remove_newlines_from_dict(
+ hit.highlight.to_dict()
+ )
+
+ log.debug('API Search highlight: %s', pformat(highlight_dict))
71
+ return highlight_dict
72
+ return None
73
74
75
class PageSearchAPIView(generics.ListAPIView):
0 commit comments