Skip to content

Commit 654f842

Browse files
committed
Moved to Rank window size
1 parent be2380b commit 654f842

File tree

1 file changed

+7
-4
lines changed
  • example-apps/relevance-workbench/app-api

1 file changed

+7
-4
lines changed

example-apps/relevance-workbench/app-api/app.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def route_api_search(index):
3131
"""
3232
[query, rrf, type, k, datasetId] = [
3333
request.args.get("q"),
34-
request.args.get("rrf", default=False, type=lambda v: v.lower() == "true"),
34+
request.args.get("rrf", default=False,
35+
type=lambda v: v.lower() == "true"),
3536
request.args.get("type", default="bm25"),
3637
request.args.get("k", default=0),
3738
request.args.get("dataset", default="movies"),
@@ -41,7 +42,8 @@ def route_api_search(index):
4142
query, index, **{"rrf": rrf, "k": k, "dataset": datasetId}
4243
)
4344
elif type == "bm25":
44-
search_result = run_full_text_search(query, index, **{"dataset": datasetId})
45+
search_result = run_full_text_search(
46+
query, index, **{"dataset": datasetId})
4547
transformed_search_result = transform_search_response(
4648
search_result, datasets[datasetId]["mapping_fields"]
4749
)
@@ -165,7 +167,7 @@ def get_hybrid_search_rrf_request_body(query, size=10, **options):
165167
"_source": False,
166168
"fields": result_fields,
167169
"size": size,
168-
"rank": {"rrf": {"window_size": 10, "rank_constant": 2}},
170+
"rank": {"rrf": {"rank_window_size": 10, "rank_constant": 2}},
169171
"sub_searches": [
170172
{"query": {"bool": {"should": text_expansions}}},
171173
{"query": {"multi_match": {"query": query, "fields": search_fields}}},
@@ -198,7 +200,8 @@ def execute_search_request_using_raw_dsl(index, body):
198200
response = es.perform_request(
199201
"POST",
200202
f"/{index}/_search",
201-
headers={"content-type": "application/json", "accept": "application/json"},
203+
headers={"content-type": "application/json",
204+
"accept": "application/json"},
202205
body=body,
203206
)
204207

0 commit comments

Comments
 (0)