diff options
-rw-r--r-- | fatcat_scholar/search.py | 3 | ||||
-rw-r--r-- | fatcat_scholar/templates/search_macros.html | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index b57a16d..d3cca80 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -286,7 +286,8 @@ def do_fulltext_search( highlight_query=highlight_query.to_dict(), require_field_match=False, number_of_fragments=2, - fragment_size=300, + fragment_size=200, + order="score", # TODO: this will fix highlight encoding, but requires ES 7.x # encoder="html", ) diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index d3dc854..6346754 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -113,7 +113,7 @@ {# this highlight HTML escape hacking should not be necessary in ES 7.x with highlight escaping #} {# but for now we manually escape, then de-escape the 'em' highlight tags #} {% autoescape false %} - {% for highlight in paper._highlights %} + {% for highlight in paper._highlights[:3] %} {{ highlight|e|replace("<em>", "<em>")|replace("</em>", "</em>") }} ... {% endfor %} {% endautoescape %} |