From 03f8d72d0601a93bf1181a9f469166cf4f26761f Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 6 Aug 2020 15:48:53 -0700 Subject: microfilm access filter; broader access matching --- fatcat_scholar/search.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'fatcat_scholar') diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index 05c7b69..7fd26b3 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -58,8 +58,9 @@ class FulltextQuery(BaseModel): "default": "fulltext", "list": [ {"label": gettext("Fulltext"), "slug": "fulltext"}, - {"label": gettext("Metadata"), "slug": "everything"}, + {"label": gettext("Microfilm"), "slug": "microfilm"}, {"label": gettext("Open Access"), "slug": "oa"}, + {"label": gettext("Metadata"), "slug": "everything"}, ], } sort_options: Any = { @@ -151,7 +152,9 @@ def do_fulltext_search( elif query.filter_availability == "everything": pass elif query.filter_availability == "fulltext" or query.filter_availability is None: - search = search.filter("terms", access_type=["wayback", "ia_file", "ia_sim"]) + search = search.filter("terms", **{"access.access_type": ["wayback", "ia_file", "ia_sim"]}) + elif query.filter_availability == "microfilm": + search = search.filter("term", **{"access.access_type": "ia_sim"}) else: raise ValueError( f"Unknown 'filter_availability' parameter value: '{query.filter_availability}'" @@ -184,7 +187,7 @@ def do_fulltext_search( "everything", ], ) - has_fulltext = Q("terms", access_type=["ia_sim", "ia_file", "wayback"],) + has_fulltext = Q("terms", **{"access_type": ["ia_sim", "ia_file", "wayback"]}) poor_metadata = Q( "bool", should=[ -- cgit v1.2.3