aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/search.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-03 14:09:38 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-03 14:09:38 -0700
commit6e1e4ec6ea74ee76b259ad99de68649a25d122ef (patch)
treed468774a6b72e6452edbe6512a92fa2fbbf7fc14 /fatcat_scholar/search.py
parentaa81a6830d02c90fe73ef1283a7f4c2773f008f8 (diff)
downloadfatcat-scholar-6e1e4ec6ea74ee76b259ad99de68649a25d122ef.tar.gz
fatcat-scholar-6e1e4ec6ea74ee76b259ad99de68649a25d122ef.zip
change availability filter phrasing; default to fulltext
Diffstat (limited to 'fatcat_scholar/search.py')
-rw-r--r--fatcat_scholar/search.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index d899711..76a2f70 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -51,10 +51,10 @@ class FulltextQuery(BaseModel):
availability_options: Any = {
"label": gettext("Availability"),
"slug": "filter_availability",
- "default": "everything",
+ "default": "fulltext",
"list": [
- {"label": gettext("Everything"), "slug": "everything"},
{"label": gettext("Fulltext"), "slug": "fulltext"},
+ {"label": gettext("Metadata"), "slug": "everything"},
{"label": gettext("Open Access"), "slug": "oa"},
],
}
@@ -124,11 +124,11 @@ def do_fulltext_search(query: FulltextQuery, deep_page_limit: int = 2000) -> Ful
# availability filters
if query.filter_availability == "oa":
# TODO: real OA filter/flag
- search = search.filter("exists", field="license_slug")
- elif query.filter_availability == "fulltext":
- search = search.filter("terms", access_type=["wayback", "ia_file", "ia_sim"])
- elif query.filter_availability == "everything" or query.filter_availability == None:
+ search = search.filter("term", tag="OA")
+ elif query.filter_availability == "everything":
pass
+ elif query.filter_availability == "fulltext" or query.filter_availability == None:
+ search = search.filter("terms", access_type=["wayback", "ia_file", "ia_sim"])
else:
raise ValueError(f"Unknown 'filter_availability' parameter value: '{query.filter_availability}'")