Explorar el Código

[search] Flatten highlighting if there is only one chunk

Romain Rigaux hace 10 años
padre
commit
2fba6b4
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      apps/search/src/search/models.py

+ 1 - 1
apps/search/src/search/models.py

@@ -836,7 +836,7 @@ def augment_solr_response(response, collection, query):
             escaped_highlighting = {}
             for field, hls in highlighting.iteritems():
               _hls = [escape(smart_unicode(hl, errors='replace')).replace('&lt;em&gt;', '<em>').replace('&lt;/em&gt;', '</em>') for hl in hls]
-              escaped_highlighting[field] = _hls
+              escaped_highlighting[field] = _hls[0] if len(_hls) == 1 else _hls
 
             doc.update(escaped_highlighting)
     else: