aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/search.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-10-27 14:33:09 -0700
committerBryan Newbold <bnewbold@archive.org>2021-10-27 18:25:58 -0700
commitb4d0bfb643842e6070a4ee36cfc52e2292e3b5ba (patch)
tree1988743c61f5c053148d66f6939ff32f398ae06e /fatcat_scholar/search.py
parent956e64f47f7d47f2539cd6575c25ec0b6a33e567 (diff)
downloadfatcat-scholar-b4d0bfb643842e6070a4ee36cfc52e2292e3b5ba.tar.gz
fatcat-scholar-b4d0bfb643842e6070a4ee36cfc52e2292e3b5ba.zip
make fmt (black 21.9b0)
Diffstat (limited to 'fatcat_scholar/search.py')
-rw-r--r--fatcat_scholar/search.py32
1 files changed, 27 insertions, 5 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index 6522fe3..7bb7424 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -156,9 +156,21 @@ def apply_filters(search: Search, query: FulltextQuery) -> Search:
"terms", type=["article-journal", "paper-conference", "chapter", "article"]
)
elif query.filter_type == "reports":
- search = search.filter("terms", type=["report", "standard",])
+ search = search.filter(
+ "terms",
+ type=[
+ "report",
+ "standard",
+ ],
+ )
elif query.filter_type == "datasets":
- search = search.filter("terms", type=["dataset", "software",])
+ search = search.filter(
+ "terms",
+ type=[
+ "dataset",
+ "software",
+ ],
+ )
elif query.filter_type == "everything":
pass
else:
@@ -291,7 +303,10 @@ def do_fulltext_search(
search = search.extra(
collapse={
"field": "collapse_key",
- "inner_hits": {"name": "more_pages", "size": 0,},
+ "inner_hits": {
+ "name": "more_pages",
+ "size": 0,
+ },
}
)
@@ -309,7 +324,11 @@ def do_fulltext_search(
allow_leading_wildcard=False,
lenient=True,
quote_field_suffix=".exact",
- fields=["title^4", "biblio_all^3", "everything",],
+ fields=[
+ "title^4",
+ "biblio_all^3",
+ "everything",
+ ],
)
has_fulltext = Q("terms", **{"access_type": ["ia_sim", "ia_file", "wayback"]})
poor_metadata = Q(
@@ -334,7 +353,10 @@ def do_fulltext_search(
search = search.sort("_doc")
else:
search = search.query(
- "boosting", positive=base_query, negative=poor_metadata, negative_boost=0.5,
+ "boosting",
+ positive=base_query,
+ negative=poor_metadata,
+ negative_boost=0.5,
)
# simplified version of basic_fulltext query, for highlighting