# HG changeset patch # User Arthur Lutz <arthur.lutz@logilab.fr> # Date 1472660204 -7200 # Wed Aug 31 18:16:44 2016 +0200 # Node ID 1704583892a85ff88599eb97e9a19f24125c2f8c # Parent faea48125bbf29aab04c3c1e36e4fb1e175a126a [views] backport fix from elasticsearch-dsl diff --git a/views.py b/views.py --- a/views.py +++ b/views.py @@ -66,8 +66,8 @@ """ Add custom highlighting """ - return search.highlight(*self.fields) \ - .highlight_options(pre_tags="", + search = search.highlight(*(f if '^' not in f else f.split('^', 1)[0] for f in self.fields)) + return search.highlight_options(pre_tags="", post_tags="", fragment_size=150)