Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: frequency value for matchingStrategy search parameter #998

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ search_parameter_guide_matching_strategy_2: |-
client.index('movies').search('big fat liar', {
'matchingStrategy': 'all'
})
search_parameter_guide_matching_strategy_3: |-
client.index('movies').search('big fat liar', {
'matchingStrategy': 'frequency'
})
search_parameter_guide_highlight_1: |-
client.index('movies').search('winter feast', {
'attributesToHighlight': ['overview']
Expand Down
14 changes: 14 additions & 0 deletions tests/index/test_index_search_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,20 @@ def test_custom_search_params_with_matching_strategy_last(index_with_documents):
assert len(response["hits"]) > 1


def test_custom_search_params_with_matching_strategy_frequency(index_with_documents):
"""Tests search with matching strategy param set to frequency"""
response = index_with_documents().search(
"man loves",
{
"limit": 5,
"matchingStrategy": "frequency",
},
)

assert isinstance(response, dict)
assert len(response["hits"]) > 1


def test_custom_search_params_with_pagination_parameters(index_with_documents):
"""Tests search with matching strategy param set to last"""
response = index_with_documents().search("", {"hitsPerPage": 1, "page": 1})
Expand Down