diff options
Diffstat (limited to 'fatcat_scholar/search.py')
-rw-r--r-- | fatcat_scholar/search.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index edff907..c9c264e 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -197,12 +197,22 @@ def do_fulltext_search( ], ) - search = search.query( - "boosting", - positive=Q("bool", must=basic_fulltext, should=[has_fulltext],), - negative=poor_metadata, - negative_boost=0.5, - ) + if query.filter_availability == "fulltext" or query.filter_availability is None: + base_query = basic_fulltext + else: + base_query = Q("bool", must=basic_fulltext, should=[has_fulltext]) + + if query.q == "*": + search = search.query("match_all") + search = search.sort("_doc") + else: + search = search.query( + "boosting", + positive=base_query, + negative=poor_metadata, + negative_boost=0.5, + ) + search = search.highlight( "abstracts.body", "fulltext.body", |