aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fatcat_scholar/search.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index c362ea6..b4ec472 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -217,12 +217,19 @@ def do_fulltext_search(
"boosting", positive=base_query, negative=poor_metadata, negative_boost=0.5,
)
+ # simplified version of basic_fulltext query, for highlighting
+ highlight_query= Q(
+ "query_string",
+ query=query.q,
+ default_operator="AND",
+ lenient=True,
+ )
search = search.highlight(
"abstracts.body",
"fulltext.body",
"fulltext.acknowledgement",
"fulltext.annex",
- highlight_query=basic_fulltext.to_dict(),
+ highlight_query=highlight_query.to_dict(),
require_field_match=False,
number_of_fragments=2,
fragment_size=300,