-
Notifications
You must be signed in to change notification settings - Fork 89
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 methods for new index settings: facetSearch
and prefixSearch
#1068
Open
thicolares
wants to merge
4
commits into
meilisearch:main
Choose a base branch
from
thicolares:add-new-index-settings-facetSearch-prefixSearch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+210
−3
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
MeilisearchCommunicationError, | ||
MeilisearchTimeoutError, | ||
) | ||
from meilisearch.models.index import ProximityPrecision | ||
from meilisearch.models.index import PrefixSearch, ProximityPrecision | ||
from meilisearch.version import qualified_version | ||
|
||
|
||
|
@@ -33,6 +33,7 @@ def send_request( | |
Mapping[str, Any], | ||
Sequence[Mapping[str, Any]], | ||
List[str], | ||
bool, | ||
bytes, | ||
str, | ||
int, | ||
|
@@ -64,7 +65,7 @@ def send_request( | |
serialize_body = isinstance(body, dict) or body | ||
data = ( | ||
json.dumps(body, cls=serializer) | ||
if serialize_body | ||
if isinstance(body, bool) or serialize_body | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe these nested |
||
else "" if body == "" else "null" | ||
) | ||
|
||
|
@@ -111,9 +112,11 @@ def put( | |
Mapping[str, Any], | ||
Sequence[Mapping[str, Any]], | ||
List[str], | ||
bool, | ||
bytes, | ||
str, | ||
int, | ||
PrefixSearch, | ||
ProximityPrecision, | ||
] | ||
] = None, | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
DEFAULT_FACET_SEARCH_SETTINGS_STATUS = True | ||
ENABLED_FACET_SEARCH_SETTINGS_STATUS = True | ||
DISABLED_FACET_SEARCH_SETTINGS_STATUS = False | ||
|
||
|
||
def test_get_facet_search_settings(empty_index): | ||
response = empty_index().get_facet_search_settings() | ||
|
||
assert DEFAULT_FACET_SEARCH_SETTINGS_STATUS == response | ||
|
||
|
||
def test_update_facet_search_settings(empty_index): | ||
index = empty_index() | ||
|
||
response = index.update_facet_search_settings(DISABLED_FACET_SEARCH_SETTINGS_STATUS) | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_facet_search_settings() | ||
assert DISABLED_FACET_SEARCH_SETTINGS_STATUS == response | ||
|
||
response = index.update_facet_search_settings(ENABLED_FACET_SEARCH_SETTINGS_STATUS) | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_facet_search_settings() | ||
assert ENABLED_FACET_SEARCH_SETTINGS_STATUS == response | ||
|
||
|
||
def test_reset_facet_search_settings(empty_index): | ||
index = empty_index() | ||
|
||
response = index.update_facet_search_settings(DISABLED_FACET_SEARCH_SETTINGS_STATUS) | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_facet_search_settings() | ||
assert DISABLED_FACET_SEARCH_SETTINGS_STATUS == response | ||
assert DEFAULT_FACET_SEARCH_SETTINGS_STATUS != response | ||
|
||
response = index.reset_facet_search_settings() | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_facet_search_settings() | ||
assert DEFAULT_FACET_SEARCH_SETTINGS_STATUS == response |
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,39 @@ | ||
from meilisearch.models.index import PrefixSearch | ||
|
||
|
||
DEFAULT_PREFIX_SEARCH_SETTINGS = PrefixSearch.INDEXING_TIME | ||
|
||
|
||
def test_get_prefix_search(empty_index): | ||
response = empty_index().get_prefix_search() | ||
|
||
assert DEFAULT_PREFIX_SEARCH_SETTINGS == response | ||
|
||
|
||
def test_update_prefix_search(empty_index): | ||
index = empty_index() | ||
|
||
response = index.update_prefix_search(PrefixSearch.DISABLED) | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_prefix_search() | ||
assert PrefixSearch.DISABLED == response | ||
|
||
response = index.update_prefix_search(PrefixSearch.INDEXING_TIME) | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_prefix_search() | ||
assert PrefixSearch.INDEXING_TIME == response | ||
|
||
|
||
def test_reset_prefix_search(empty_index): | ||
index = empty_index() | ||
|
||
response = index.update_prefix_search(PrefixSearch.DISABLED) | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_prefix_search() | ||
assert PrefixSearch.DISABLED == response | ||
assert DEFAULT_PREFIX_SEARCH_SETTINGS != response | ||
|
||
response = index.reset_prefix_search() | ||
index.wait_for_task(response.task_uid) | ||
response = index.get_prefix_search() | ||
assert DEFAULT_PREFIX_SEARCH_SETTINGS == response |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Note inconsistency:
get_facet_search_settings
(note the_settings
suffix) xget_prefix_search
. Is there a reason for that? I left as is for consistency with existing implementations.