-
Notifications
You must be signed in to change notification settings - Fork 97
feat: Added sharding support for python sdk #1164
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThese changes add network sharding support to the MeiliSearch client by introducing an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/client/test_client_multi_search_meilisearch.py (1)
107-107: Add assertion to verify sharding was configured.The response from
add_or_update_networksshould be validated to confirm that sharding was successfully enabled, similar to the assertion intest_client_network.pyline 37.Apply this diff to add the missing assertion:
assert "results" not in resp + assert resp["sharding"] is True assert "results" not in response
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
meilisearch/models/task.py(1 hunks)tests/client/test_client_multi_search_meilisearch.py(1 hunks)tests/client/test_client_network.py(1 hunks)tests/client/test_client_sharding.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/client/test_client_network.py (2)
tests/conftest.py (1)
client(15-16)meilisearch/client.py (1)
add_or_update_networks(779-799)
tests/client/test_client_sharding.py (2)
tests/conftest.py (1)
client(15-16)meilisearch/client.py (2)
add_or_update_networks(779-799)get_all_networks(801-814)
🔇 Additional comments (4)
tests/client/test_client_multi_search_meilisearch.py (1)
84-101: LGTM! Network configuration correctly includes sharding and writeApiKey fields.The addition of
"sharding": Trueand"writeApiKey"fields to the network configuration aligns with the PR's objective of introducing sharding support.tests/client/test_client_network.py (1)
17-37: LGTM! Test properly validates sharding configuration.The test correctly adds the
shardingflag andwriteApiKeyfields to the network configuration, and includes appropriate assertions to verify the response.tests/client/test_client_sharding.py (1)
1-35: LGTM! Comprehensive test coverage for sharding functionality.This new test file provides thorough validation of the sharding feature, including:
- Setting network configuration with sharding enabled
- Validating writeApiKey fields are properly stored and retrieved
- Confirming the sharding flag persists across update/get operations
meilisearch/models/task.py (1)
24-24: The Task.network field is correctly implemented and will deserialize from API responses.The field definition follows the correct pattern for optional generic dictionaries. When the network experimental feature is enabled, the field will contain replication metadata (origin or remotes data), and Pydantic will automatically deserialize it from the API response. The existing network tests in the codebase validate network configuration endpoints; the field itself will be populated transparently when tasks are retrieved.
d43103a to
48b1dd0
Compare
Pull Request
This PR introduces sharding support to the Meilisearch Python SDK. I have tested the sharding functionality locally using two remote nodes, and all related test cases passed successfully.
Related issue
Fixes #<1137>
What does this PR do?
As mentioned in the issue, I have tested all of these points locally and added tests for the parts that can be covered within the test suite.
PR checklist
Please check if your PR fulfills the following requirements:
Summary by CodeRabbit
New Features
Tests