Skip to content

Commit d3143b3

Browse files
authored
Merge pull request #522 from meilisearch/add-tests-to-matching
Add tests to custom search with matching_strategy param
2 parents dabf42c + 72d365c commit d3143b3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/index/test_index_search_meilisearch.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,29 @@ def test_search_on_nested_documents_with_sortable_attributes(index_with_document
436436
)
437437
assert isinstance(response, dict)
438438
assert response['hits'][0]['id'] == 6
439+
440+
def test_custom_search_params_with_matching_strategy_all(index_with_documents):
441+
"""Tests search with matching strategy param set to all"""
442+
response = index_with_documents().search(
443+
'man loves',
444+
{
445+
'limit': 5,
446+
'matchingStrategy': 'all',
447+
}
448+
)
449+
450+
assert isinstance(response, dict)
451+
assert len(response['hits']) == 1
452+
453+
def test_custom_search_params_with_matching_strategy_last(index_with_documents):
454+
"""Tests search with matching strategy param set to last"""
455+
response = index_with_documents().search(
456+
'man loves',
457+
{
458+
'limit': 5,
459+
'matchingStrategy': 'last',
460+
}
461+
)
462+
463+
assert isinstance(response, dict)
464+
assert len(response['hits']) > 1

0 commit comments

Comments
 (0)