diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-08-06 15:48:53 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-08-06 19:01:12 -0700 |
commit | 03f8d72d0601a93bf1181a9f469166cf4f26761f (patch) | |
tree | 0abfe4ccd4ffc27142412527772261a1de74e657 /fatcat_scholar | |
parent | f0dcc9dafcb280ff522ff4fc8739af4e46cb8768 (diff) | |
download | fatcat-scholar-03f8d72d0601a93bf1181a9f469166cf4f26761f.tar.gz fatcat-scholar-03f8d72d0601a93bf1181a9f469166cf4f26761f.zip |
microfilm access filter; broader access matching
Diffstat (limited to 'fatcat_scholar')
-rw-r--r-- | fatcat_scholar/search.py | 9 |
1 files changed, 6 insertions, 3 deletions
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=[ |