-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
971: Add proximityPrecision setting r=curquiza a=the-sinner # Pull Request ## Related issue Fixes #916 ## What does this PR do? - Add proximityPrecision setting ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Shalabh Agarwal <[email protected]>
- Loading branch information
Showing
6 changed files
with
132 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/settings/test_settings_proximity_precision_meilisearch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from meilisearch.models.index import ProximityPrecision | ||
|
||
NEW_PROXIMITY_PRECISION = ProximityPrecision.BY_ATTRIBUTE | ||
|
||
|
||
def test_get_proximity_precision(empty_index): | ||
"""Tests getting default proximity precision.""" | ||
response = empty_index().get_proximity_precision() | ||
assert response == ProximityPrecision.BY_WORD | ||
|
||
|
||
def test_update_proximity_precision(empty_index): | ||
"""Tests updating proximity precision.""" | ||
index = empty_index() | ||
response = index.update_proximity_precision(NEW_PROXIMITY_PRECISION) | ||
update = index.wait_for_task(response.task_uid) | ||
assert update.status == "succeeded" | ||
response = index.get_proximity_precision() | ||
assert NEW_PROXIMITY_PRECISION == response | ||
|
||
|
||
def test_reset_proximity_precision(empty_index): | ||
"""Tests resetting the proximity precision to its default value.""" | ||
index = empty_index() | ||
# Update the settings first | ||
response = index.update_proximity_precision(NEW_PROXIMITY_PRECISION) | ||
update = index.wait_for_task(response.task_uid) | ||
assert update.status == "succeeded" | ||
# Check the settings have been correctly updated | ||
response = index.get_proximity_precision() | ||
assert NEW_PROXIMITY_PRECISION == response | ||
# Check the reset of the settings | ||
response = index.reset_proximity_precision() | ||
update = index.wait_for_task(response.task_uid) | ||
assert update.status == "succeeded" | ||
response = index.get_proximity_precision() | ||
assert response == ProximityPrecision.BY_WORD |