Skip to content

Changes related to the next Meilisearch release (v0.29.0) #518

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

Merged
merged 10 commits into from
Oct 3, 2022
Merged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ index.search(

## 🤖 Compatibility with Meilisearch

This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).
This package only guarantees the compatibility with the [version v0.29.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.29.0).

## 💡 Learn More

Expand Down
7 changes: 7 additions & 0 deletions tests/client/test_client_key_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ def test_create_keys_with_options(client, test_key_info):
assert key['actions'] == test_key_info['actions']
assert key['indexes'] == test_key_info['indexes']

def test_create_keys_with_wildcarded_actions(client, test_key_info):
"""Tests the creation of a key with an action which contains a wildcard."""
key = client.create_key(options={'description': test_key_info['description'], 'actions': ['documents.*'], 'indexes': test_key_info['indexes'], 'expiresAt': None })

assert isinstance(key, dict)
assert key['actions'] == ['documents.*']

def test_create_keys_without_actions(client):
"""Tests the creation of a key with missing arguments."""
with pytest.raises(MeiliSearchApiError):
Expand Down
18 changes: 12 additions & 6 deletions tests/index/test_index_document_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,23 @@ def test_update_documents(index_with_documents, small_movies):
"""Tests updating a single document and a set of documents."""
index = index_with_documents()
response = index.get_documents()
response.results[0].title = 'Some title'
update = index.update_documents([dict(response.results[0])])
doc = response.results[0]
doc.title = 'Some title'

update = index.update_documents([dict(doc)])

assert isinstance(update, TaskInfo)
assert update.task_uid != None
index.wait_for_task(update.task_uid)
response = index.get_documents()
assert response.results[0].title == 'Some title'

response = index.get_document(doc.id)
assert response.title == 'Some title'

update = index.update_documents(small_movies)
index.wait_for_task(update.task_uid)
response = index.get_documents()
assert response.results[0].title != 'Some title'

response = index.get_document(doc.id)
assert response.title != 'Some title'

@pytest.mark.parametrize('batch_size', [2, 3, 1000])
@pytest.mark.parametrize(
Expand Down
26 changes: 26 additions & 0 deletions tests/index/test_index_search_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,29 @@ def test_search_on_nested_documents_with_sortable_attributes(index_with_document
)
assert isinstance(response, dict)
assert response['hits'][0]['id'] == 6

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

assert isinstance(response, dict)
assert len(response['hits']) == 1

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

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