@@ -155,35 +155,10 @@ def _indexing_helper(html_objs_qs, wipe=False):
155
155
delete_objects_in_es .delay (** kwargs )
156
156
157
157
158
- def _remove_newlines_from_dict (highlight ):
159
- """
160
- Recursively change results to turn newlines into periods.
161
-
162
- See: https://github.com/rtfd/readthedocs.org/issues/5168
163
- :param highlight: highlight dict whose contents are to be edited.
164
- :type highlight: dict
165
- :returns: dict with all the newlines changed to periods.
166
- :rtype: dict
167
- """
168
- for k , v in highlight .items ():
169
- if isinstance (v , dict ):
170
- highlight [k ] = _remove_newlines_from_dict (v )
171
- else :
172
- # elastic returns the contents of the
173
- # highlighted field in a list.
174
- if isinstance (v , list ):
175
- v_new_list = [res .replace ('\n ' , '. ' ) for res in v ]
176
- highlight [k ] = v_new_list
177
-
178
- return highlight
179
-
180
-
181
158
def _get_inner_hits_highlights (hit , logging = False ):
182
- """Removes new lines from highlight dict """
159
+ """Returns highlight dict and does conditional logging of the same. """
183
160
if hasattr (hit , 'highlight' ):
184
- highlight_dict = _remove_newlines_from_dict (
185
- hit .highlight .to_dict ()
186
- )
161
+ highlight_dict = hit .highlight .to_dict ()
187
162
188
163
if logging :
189
164
log .debug ('API Search highlight: %s' , pformat (highlight_dict ))
0 commit comments