Skip to content

Commit fc393e7

Browse files
authored
Use a partial match mode as the search mode for instructor fields(#1652)
1 parent 15652f0 commit fc393e7

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

learning_resources_search/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def generate_learning_resources_text_clause(text, search_mode, slop):
289289
query_type: {
290290
"query": text,
291291
"fields": RUN_INSTRUCTORS_QUERY_FIELDS,
292-
**extra_params,
292+
"type": "best_fields",
293293
}
294294
},
295295
}

learning_resources_search/api_test.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,10 @@ def test_generate_learning_resources_text_clause(search_mode, slop):
235235
"multi_match": {
236236
"query": "math",
237237
"fields": [
238-
"runs.instructors.first_name",
239238
"runs.instructors.last_name^5",
240239
"runs.instructors.full_name^5",
241240
],
242-
**extra_params,
241+
"type": "best_fields",
243242
}
244243
},
245244
}
@@ -350,11 +349,10 @@ def test_generate_learning_resources_text_clause(search_mode, slop):
350349
"multi_match": {
351350
"query": "math",
352351
"fields": [
353-
"runs.instructors.first_name",
354352
"runs.instructors.last_name^5",
355353
"runs.instructors.full_name^5",
356354
],
357-
**extra_params,
355+
"type": "best_fields",
358356
}
359357
},
360358
}
@@ -468,10 +466,10 @@ def test_generate_learning_resources_text_clause(search_mode, slop):
468466
"query_string": {
469467
"query": '"math"',
470468
"fields": [
471-
"runs.instructors.first_name",
472469
"runs.instructors.last_name^5",
473470
"runs.instructors.full_name^5",
474471
],
472+
"type": "best_fields",
475473
}
476474
},
477475
}
@@ -576,10 +574,10 @@ def test_generate_learning_resources_text_clause(search_mode, slop):
576574
"query_string": {
577575
"query": '"math"',
578576
"fields": [
579-
"runs.instructors.first_name",
580577
"runs.instructors.last_name^5",
581578
"runs.instructors.full_name^5",
582579
],
580+
"type": "best_fields",
583581
}
584582
},
585583
}
@@ -1155,7 +1153,6 @@ def test_execute_learn_search_for_learning_resource_query(opensearch):
11551153
"multi_match": {
11561154
"query": "math",
11571155
"fields": [
1158-
"runs.instructors.first_name",
11591156
"runs.instructors.last_name^5",
11601157
"runs.instructors.full_name^5",
11611158
],
@@ -1275,7 +1272,6 @@ def test_execute_learn_search_for_learning_resource_query(opensearch):
12751272
"multi_match": {
12761273
"query": "math",
12771274
"fields": [
1278-
"runs.instructors.first_name",
12791275
"runs.instructors.last_name^5",
12801276
"runs.instructors.full_name^5",
12811277
],
@@ -1626,11 +1622,10 @@ def test_execute_learn_search_with_script_score(
16261622
"multi_match": {
16271623
"query": "math",
16281624
"fields": [
1629-
"runs.instructors.first_name",
16301625
"runs.instructors.last_name^5",
16311626
"runs.instructors.full_name^5",
16321627
],
1633-
"type": "phrase",
1628+
"type": "best_fields",
16341629
}
16351630
},
16361631
}
@@ -1746,11 +1741,10 @@ def test_execute_learn_search_with_script_score(
17461741
"multi_match": {
17471742
"query": "math",
17481743
"fields": [
1749-
"runs.instructors.first_name",
17501744
"runs.instructors.last_name^5",
17511745
"runs.instructors.full_name^5",
17521746
],
1753-
"type": "phrase",
1747+
"type": "best_fields",
17541748
}
17551749
},
17561750
}
@@ -2057,7 +2051,6 @@ def test_execute_learn_search_with_min_score(mocker, settings, opensearch):
20572051
"multi_match": {
20582052
"query": "math",
20592053
"fields": [
2060-
"runs.instructors.first_name",
20612054
"runs.instructors.last_name^5",
20622055
"runs.instructors.full_name^5",
20632056
],
@@ -2177,7 +2170,6 @@ def test_execute_learn_search_with_min_score(mocker, settings, opensearch):
21772170
"multi_match": {
21782171
"query": "math",
21792172
"fields": [
2180-
"runs.instructors.first_name",
21812173
"runs.instructors.last_name^5",
21822174
"runs.instructors.full_name^5",
21832175
],

learning_resources_search/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ class FilterConfig:
380380
]
381381

382382
RUN_INSTRUCTORS_QUERY_FIELDS = [
383-
"runs.instructors.first_name",
384383
"runs.instructors.last_name^5",
385384
"runs.instructors.full_name^5",
386385
]

0 commit comments

Comments
 (0)