removed fuzziness from person names matching + added applying rescoring strategy when query is empty

This commit is contained in:
2026-06-10 14:13:28 +02:00
parent 486ea0d2ba
commit 0f212d189e
+25 -17
View File
@@ -275,14 +275,13 @@ def build_authors_search_rescored(
}
}
},
# {
# "match": {
# "display_name": {
# "query": query,
# "fuzziness": 1
# }
# }
# }
{
"match": {
"display_name": {
"query": query
}
}
}
],
"minimum_should_match": 1
}
@@ -473,7 +472,7 @@ def build_authors_search_rescored(
functions.append(works_count_boost_query)
# Combine query and filters
body = {}
if functions:
inner_query = None
if query_clause:
@@ -486,6 +485,15 @@ def build_authors_search_rescored(
}
else:
inner_query = query_clause
# if query not null then multiply with name matching
body["query"] = {
"function_score": {
"query": inner_query,
"functions": functions,
"score_mode": "multiply",
"boost_mode": "multiply"
}
}
else:
if filter_clauses:
inner_query = {
@@ -495,15 +503,15 @@ def build_authors_search_rescored(
}
else:
inner_query = {"match_all": {}}
body["query"] = {
"function_score": {
"query": inner_query,
"functions": functions,
"score_mode": "multiply",
"boost_mode": "replace"
# if the query is null, replace the scoring completely
body["query"] = {
"function_score": {
"query": inner_query,
"functions": functions,
"score_mode": "multiply",
"boost_mode": "replace"
}
}
}
else:
if query_clause:
if filter_clauses: