aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/search.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web/search.py')
-rw-r--r--python/fatcat_web/search.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py
index 8cbe09f6..2a3515d4 100644
--- a/python/fatcat_web/search.py
+++ b/python/fatcat_web/search.py
@@ -178,7 +178,7 @@ def do_container_search(query: GenericQuery, deep_page_limit: int = 2000) -> Sea
search = Search(using=app.es_client, index=app.config["ELASTICSEARCH_CONTAINER_INDEX"])
- search = search.query(
+ basic_query = Q(
"query_string",
query=query.q,
default_operator="AND",
@@ -188,6 +188,20 @@ def do_container_search(query: GenericQuery, deep_page_limit: int = 2000) -> Sea
fields=["biblio"],
)
+ search = search.query(
+ "boosting",
+ positive=Q(
+ "bool",
+ must=basic_query,
+ should=[
+ Q("range", releases_total={"gte": 500}),
+ Q("range", releases_total={"gte": 5000}),
+ ],
+ ),
+ negative=Q("term", releases_total=0),
+ negative_boost=0.5,
+ )
+
# Sanity checks
limit = min((int(query.limit or 25), 100))
offset = max((int(query.offset or 0), 0))