meilisearch-python-sdk 6.1.0__tar.gz → 7.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/workflows/testing.yml +8 -4
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.pre-commit-config.yaml +1 -1
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/PKG-INFO +1 -1
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/_client.py +9 -0
- meilisearch_python_sdk-7.0.0/meilisearch_python_sdk/_version.py +1 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/index/_common.py +4 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/index/async_index.py +16 -5
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/index/index.py +16 -5
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/index.py +7 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/search.py +2 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/pyproject.toml +2 -2
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_async_index.py +5 -5
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_async_search.py +24 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_index.py +5 -5
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_search.py +24 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/uv.lock +235 -235
- meilisearch_python_sdk-6.1.0/meilisearch_python_sdk/_version.py +0 -1
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/FUNDING.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/release-draft-template.yaml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/renovate.json5 +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/workflows/docs_publish.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/workflows/nightly_testing.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/workflows/pypi_publish.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.github/workflows/release-drafter.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/.gitignore +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/CONTRIBUTING.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/LICENSE +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/README.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/assets/add_in_batches.png +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/assets/searches.png +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/codecov.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/datasets/small_movies.json +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docker-compose.https.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docker-compose.yml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/.nojekyll +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/CNAME +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/async_client_api.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/async_index_api.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/client_api.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/css/custom.css +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/decorators_api.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/index.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/index_api.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/js/umami.js +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/json_handler.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/overrides/partials/footer.html +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/plugins.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/docs/pydantic.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/.gitignore +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/README.md +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/__init__.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/add_documents_decorator.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/add_documents_in_batches.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/async_add_documents_decorator.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/async_add_documents_in_batches.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/async_documents_and_search_results.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/async_search_tracker.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/async_update_settings.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/documents_and_search_results.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/fastapi_example.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/orjson_example.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/pyproject.toml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/requirements.txt +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/search_tracker.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/tests/__init__.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/tests/conftest.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/tests/test_async_examples.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/tests/test_examples.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/examples/update_settings.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/justfile +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/__init__.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/_batch.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/_http_requests.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/_task.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/_utils.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/decorators.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/errors.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/index/__init__.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/json_handler.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/__init__.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/batch.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/client.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/documents.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/health.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/settings.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/task.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/version.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/models/webhook.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/plugins.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/py.typed +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/types.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/mkdocs.yaml +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/__init__.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/conftest.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_async_client.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_async_documents.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_async_index_plugins.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_client.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_decorators.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_documents.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_errors.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_http_requests.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_index_plugins.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_settings_models.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_utils.py +0 -0
- {meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/tests/test_version.py +0 -0
|
@@ -53,8 +53,9 @@ jobs:
|
|
|
53
53
|
run: just test-parallel-ci
|
|
54
54
|
- name: Upload coverage
|
|
55
55
|
uses: codecov/codecov-action@v5.5.2
|
|
56
|
+
env:
|
|
57
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
56
58
|
with:
|
|
57
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
58
59
|
fail_ci_if_error: true
|
|
59
60
|
|
|
60
61
|
parallel-testing-http2:
|
|
@@ -93,8 +94,9 @@ jobs:
|
|
|
93
94
|
run: just test-parallel-ci-http2
|
|
94
95
|
- name: Upload coverage
|
|
95
96
|
uses: codecov/codecov-action@v5.5.2
|
|
97
|
+
env:
|
|
98
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
96
99
|
with:
|
|
97
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
98
100
|
fail_ci_if_error: true
|
|
99
101
|
|
|
100
102
|
no-parallel-testing:
|
|
@@ -122,8 +124,9 @@ jobs:
|
|
|
122
124
|
run: just test-no-parallel-ci
|
|
123
125
|
- name: Upload coverage
|
|
124
126
|
uses: codecov/codecov-action@v5.5.2
|
|
127
|
+
env:
|
|
128
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
125
129
|
with:
|
|
126
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
127
130
|
fail_ci_if_error: true
|
|
128
131
|
|
|
129
132
|
no-parallel-testing-http2:
|
|
@@ -162,8 +165,9 @@ jobs:
|
|
|
162
165
|
run: just test-no-parallel-ci-http2
|
|
163
166
|
- name: Upload coverage
|
|
164
167
|
uses: codecov/codecov-action@v5.5.2
|
|
168
|
+
env:
|
|
169
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
165
170
|
with:
|
|
166
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
167
171
|
fail_ci_if_error: true
|
|
168
172
|
example-testing:
|
|
169
173
|
strategy:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meilisearch-python-sdk
|
|
3
|
-
Version:
|
|
3
|
+
Version: 7.0.0
|
|
4
4
|
Summary: A Python client providing both async and sync support for the Meilisearch API
|
|
5
5
|
Project-URL: repository, https://github.com/sanders41/meilisearch-python-sdk
|
|
6
6
|
Project-URL: homepage, https://github.com/sanders41/meilisearch-python-sdk
|
{meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/_client.py
RENAMED
|
@@ -814,6 +814,9 @@ class AsyncClient(BaseClient):
|
|
|
814
814
|
if query.media is None:
|
|
815
815
|
del q["media"]
|
|
816
816
|
|
|
817
|
+
if query.show_performance_details is None:
|
|
818
|
+
del q["showPerformanceDetails"]
|
|
819
|
+
|
|
817
820
|
processed_queries.append(q)
|
|
818
821
|
|
|
819
822
|
if federation:
|
|
@@ -1970,6 +1973,12 @@ class Client(BaseClient):
|
|
|
1970
1973
|
del q["limit"]
|
|
1971
1974
|
del q["offset"]
|
|
1972
1975
|
|
|
1976
|
+
if query.media is None:
|
|
1977
|
+
del q["media"]
|
|
1978
|
+
|
|
1979
|
+
if query.show_performance_details is None:
|
|
1980
|
+
del q["showPerformanceDetails"]
|
|
1981
|
+
|
|
1973
1982
|
processed_queries.append(q)
|
|
1974
1983
|
|
|
1975
1984
|
if federation:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "7.0.0"
|
|
@@ -140,6 +140,7 @@ def process_search_parameters(
|
|
|
140
140
|
retrieve_vectors: bool | None = None,
|
|
141
141
|
exhaustive_facet_count: bool | None = None,
|
|
142
142
|
media: JsonMapping | None = None,
|
|
143
|
+
show_performance_details: bool = False,
|
|
143
144
|
) -> JsonDict:
|
|
144
145
|
if attributes_to_retrieve is None:
|
|
145
146
|
attributes_to_retrieve = ["*"]
|
|
@@ -197,6 +198,9 @@ def process_search_parameters(
|
|
|
197
198
|
if media is not None:
|
|
198
199
|
body["media"] = media
|
|
199
200
|
|
|
201
|
+
if show_performance_details:
|
|
202
|
+
body["showPerformanceDetails"] = True
|
|
203
|
+
|
|
200
204
|
return body
|
|
201
205
|
|
|
202
206
|
|
|
@@ -31,7 +31,7 @@ from meilisearch_python_sdk.index._common import (
|
|
|
31
31
|
from meilisearch_python_sdk.index._common import combine_documents as combine_documents_
|
|
32
32
|
from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
|
|
33
33
|
from meilisearch_python_sdk.models.documents import DocumentsInfo
|
|
34
|
-
from meilisearch_python_sdk.models.index import Field, FieldsFilter, IndexStats
|
|
34
|
+
from meilisearch_python_sdk.models.index import Field, FieldResults, FieldsFilter, IndexStats
|
|
35
35
|
from meilisearch_python_sdk.models.search import (
|
|
36
36
|
FacetSearchResults,
|
|
37
37
|
Hybrid,
|
|
@@ -712,6 +712,7 @@ class AsyncIndex(BaseIndex):
|
|
|
712
712
|
locales: list[str] | None = None,
|
|
713
713
|
retrieve_vectors: bool | None = None,
|
|
714
714
|
media: JsonMapping | None = None,
|
|
715
|
+
show_performance_details: bool = False,
|
|
715
716
|
) -> SearchResults:
|
|
716
717
|
"""Search the index.
|
|
717
718
|
|
|
@@ -780,6 +781,8 @@ class AsyncIndex(BaseIndex):
|
|
|
780
781
|
to /experimental-features with { "multimodal": true }. Because this feature is
|
|
781
782
|
experimental it may be removed or updated causing breaking changes in this library
|
|
782
783
|
without a major version bump so use with caution.
|
|
784
|
+
show_performance_details: When set to true, the search response contains a performance
|
|
785
|
+
trace. Default False.
|
|
783
786
|
|
|
784
787
|
Returns:
|
|
785
788
|
Results of the search
|
|
@@ -825,6 +828,7 @@ class AsyncIndex(BaseIndex):
|
|
|
825
828
|
locales=locales,
|
|
826
829
|
retrieve_vectors=retrieve_vectors,
|
|
827
830
|
media=media,
|
|
831
|
+
show_performance_details=show_performance_details,
|
|
828
832
|
)
|
|
829
833
|
search_url = f"{self._base_url_with_uid}/search"
|
|
830
834
|
|
|
@@ -4817,7 +4821,7 @@ class AsyncIndex(BaseIndex):
|
|
|
4817
4821
|
|
|
4818
4822
|
async def fields(
|
|
4819
4823
|
self, offset: int = 0, limit: int = 20, filter: FieldsFilter | None = None
|
|
4820
|
-
) ->
|
|
4824
|
+
) -> FieldResults:
|
|
4821
4825
|
"""Get the field properties on an index.
|
|
4822
4826
|
|
|
4823
4827
|
Args:
|
|
@@ -4826,7 +4830,7 @@ class AsyncIndex(BaseIndex):
|
|
|
4826
4830
|
filter: Filter fields to return based on properties. Defaults to None.
|
|
4827
4831
|
|
|
4828
4832
|
Returns:
|
|
4829
|
-
|
|
4833
|
+
Field properties
|
|
4830
4834
|
|
|
4831
4835
|
Raises:
|
|
4832
4836
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
@@ -4845,8 +4849,15 @@ class AsyncIndex(BaseIndex):
|
|
|
4845
4849
|
f"{self._base_url_with_uid}/fields",
|
|
4846
4850
|
body={"offset": offset, "limit": limit, "filter": filter_value},
|
|
4847
4851
|
)
|
|
4848
|
-
|
|
4849
|
-
|
|
4852
|
+
response_json = response.json()
|
|
4853
|
+
fields = [Field(**field) for field in response_json["results"]]
|
|
4854
|
+
|
|
4855
|
+
return FieldResults(
|
|
4856
|
+
fields=fields,
|
|
4857
|
+
offset=response_json["offset"],
|
|
4858
|
+
limit=response_json["limit"],
|
|
4859
|
+
total=response_json["total"],
|
|
4860
|
+
)
|
|
4850
4861
|
|
|
4851
4862
|
@staticmethod
|
|
4852
4863
|
async def _run_plugins(
|
{meilisearch_python_sdk-6.1.0 → meilisearch_python_sdk-7.0.0}/meilisearch_python_sdk/index/index.py
RENAMED
|
@@ -28,7 +28,7 @@ from meilisearch_python_sdk.index._common import (
|
|
|
28
28
|
from meilisearch_python_sdk.index._common import combine_documents as combine_documents_
|
|
29
29
|
from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
|
|
30
30
|
from meilisearch_python_sdk.models.documents import DocumentsInfo
|
|
31
|
-
from meilisearch_python_sdk.models.index import Field, FieldsFilter, IndexStats
|
|
31
|
+
from meilisearch_python_sdk.models.index import Field, FieldResults, FieldsFilter, IndexStats
|
|
32
32
|
from meilisearch_python_sdk.models.search import (
|
|
33
33
|
FacetSearchResults,
|
|
34
34
|
Hybrid,
|
|
@@ -586,6 +586,7 @@ class Index(BaseIndex):
|
|
|
586
586
|
locales: list[str] | None = None,
|
|
587
587
|
retrieve_vectors: bool | None = None,
|
|
588
588
|
media: JsonMapping | None = None,
|
|
589
|
+
show_performance_details: bool = False,
|
|
589
590
|
) -> SearchResults:
|
|
590
591
|
"""Search the index.
|
|
591
592
|
|
|
@@ -654,6 +655,8 @@ class Index(BaseIndex):
|
|
|
654
655
|
to /experimental-features with { "multimodal": true }. Because this feature is
|
|
655
656
|
experimental it may be removed or updated causing breaking changes in this library
|
|
656
657
|
without a major version bump so use with caution.
|
|
658
|
+
show_performance_details: When set to true, the search response contains a performance
|
|
659
|
+
trace. Default False.
|
|
657
660
|
|
|
658
661
|
Returns:
|
|
659
662
|
Results of the search
|
|
@@ -699,6 +702,7 @@ class Index(BaseIndex):
|
|
|
699
702
|
locales=locales,
|
|
700
703
|
retrieve_vectors=retrieve_vectors,
|
|
701
704
|
media=media,
|
|
705
|
+
show_performance_details=show_performance_details,
|
|
702
706
|
)
|
|
703
707
|
|
|
704
708
|
if self._pre_search_plugins:
|
|
@@ -3812,7 +3816,7 @@ class Index(BaseIndex):
|
|
|
3812
3816
|
|
|
3813
3817
|
def fields(
|
|
3814
3818
|
self, offset: int = 0, limit: int = 20, filter: FieldsFilter | None = None
|
|
3815
|
-
) ->
|
|
3819
|
+
) -> FieldResults:
|
|
3816
3820
|
"""Get the field properties on an index.
|
|
3817
3821
|
|
|
3818
3822
|
Args:
|
|
@@ -3821,7 +3825,7 @@ class Index(BaseIndex):
|
|
|
3821
3825
|
filter: Filter fields to return based on properties. Defaults to None.
|
|
3822
3826
|
|
|
3823
3827
|
Returns:
|
|
3824
|
-
|
|
3828
|
+
Field properties
|
|
3825
3829
|
|
|
3826
3830
|
Raises:
|
|
3827
3831
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
@@ -3840,8 +3844,15 @@ class Index(BaseIndex):
|
|
|
3840
3844
|
f"{self._base_url_with_uid}/fields",
|
|
3841
3845
|
body={"offset": offset, "limit": limit, "filter": filter_value},
|
|
3842
3846
|
)
|
|
3843
|
-
|
|
3844
|
-
|
|
3847
|
+
response_json = response.json()
|
|
3848
|
+
fields = [Field(**field) for field in response_json["results"]]
|
|
3849
|
+
|
|
3850
|
+
return FieldResults(
|
|
3851
|
+
fields=fields,
|
|
3852
|
+
offset=response_json["offset"],
|
|
3853
|
+
limit=response_json["limit"],
|
|
3854
|
+
total=response_json["total"],
|
|
3855
|
+
)
|
|
3845
3856
|
|
|
3846
3857
|
@staticmethod
|
|
3847
3858
|
def _run_plugins(
|
|
@@ -72,6 +72,7 @@ class SearchParams(CamelBase):
|
|
|
72
72
|
locales: list[str] | None = None
|
|
73
73
|
retrieve_vectors: bool | None = None
|
|
74
74
|
media: JsonMapping | None = None
|
|
75
|
+
show_performance_details: bool | None = None
|
|
75
76
|
|
|
76
77
|
@field_validator("ranking_score_threshold", mode="before") # type: ignore[attr-defined]
|
|
77
78
|
@classmethod
|
|
@@ -96,6 +97,7 @@ class SearchResults(CamelBase, Generic[T]):
|
|
|
96
97
|
hits_per_page: int | None = None
|
|
97
98
|
semantic_hit_count: int | None = None
|
|
98
99
|
query_vector: list[float] | None = None
|
|
100
|
+
performance_details: JsonDict | None = None
|
|
99
101
|
|
|
100
102
|
|
|
101
103
|
class SearchResultsWithUID(SearchResults, Generic[T]):
|
|
@@ -39,14 +39,14 @@ all = ["orjson"]
|
|
|
39
39
|
dev = [
|
|
40
40
|
"mkdocs==1.6.1",
|
|
41
41
|
"mkdocs-material==9.7.1",
|
|
42
|
-
"mkdocstrings[python]==1.0.
|
|
42
|
+
"mkdocstrings[python]==1.0.2",
|
|
43
43
|
"mypy[faster-cache]>=1.19.1",
|
|
44
44
|
"pytest==9.0.2",
|
|
45
45
|
"pytest-cov==7.0.0",
|
|
46
46
|
"pytest-asyncio==1.3.0",
|
|
47
47
|
"pytest-xdist==3.8.0",
|
|
48
48
|
"prek>=0.2.27",
|
|
49
|
-
"ruff==0.14.
|
|
49
|
+
"ruff==0.14.14",
|
|
50
50
|
"types-aiofiles==25.1.0.20251011",
|
|
51
51
|
"typing-extensions==4.15.0",
|
|
52
52
|
]
|
|
@@ -1037,14 +1037,14 @@ async def test_compact(async_client, async_index_with_documents):
|
|
|
1037
1037
|
async def test_fields(async_index_with_documents):
|
|
1038
1038
|
index = await async_index_with_documents()
|
|
1039
1039
|
result = await index.fields()
|
|
1040
|
-
assert "genre" in [field.name for field in result]
|
|
1040
|
+
assert "genre" in [field.name for field in result.fields]
|
|
1041
1041
|
|
|
1042
1042
|
|
|
1043
1043
|
async def test_fields_with_limit_and_offset(async_index_with_documents):
|
|
1044
1044
|
index = await async_index_with_documents()
|
|
1045
1045
|
result = await index.fields(limit=2, offset=2)
|
|
1046
|
-
assert len(result) == 2
|
|
1047
|
-
assert "overview" in [field.name for field in result]
|
|
1046
|
+
assert len(result.fields) == 2
|
|
1047
|
+
assert "overview" in [field.name for field in result.fields]
|
|
1048
1048
|
|
|
1049
1049
|
|
|
1050
1050
|
async def test_fields_with_filter(async_client, async_index_with_documents):
|
|
@@ -1053,5 +1053,5 @@ async def test_fields_with_filter(async_client, async_index_with_documents):
|
|
|
1053
1053
|
task = await index.update_sortable_attributes(["title"])
|
|
1054
1054
|
await async_client.wait_for_task(task.task_uid)
|
|
1055
1055
|
result = await index.fields(filter=filter)
|
|
1056
|
-
assert len(result) == 1
|
|
1057
|
-
assert "title" in result[0].name
|
|
1056
|
+
assert len(result.fields) == 1
|
|
1057
|
+
assert "title" in result.fields[0].name
|
|
@@ -632,6 +632,24 @@ async def test_multi_search_ranking_score_threshold(async_client, async_index_wi
|
|
|
632
632
|
assert len(result[0].hits) > 0
|
|
633
633
|
|
|
634
634
|
|
|
635
|
+
async def test_multi_search_show_performance_details(async_client, async_index_with_documents):
|
|
636
|
+
index1 = await async_index_with_documents()
|
|
637
|
+
index2 = await async_index_with_documents()
|
|
638
|
+
response = await async_client.multi_search(
|
|
639
|
+
[
|
|
640
|
+
SearchParams(
|
|
641
|
+
index_uid=index1.uid,
|
|
642
|
+
query="How to Train Your Dragon",
|
|
643
|
+
show_performance_details=True,
|
|
644
|
+
),
|
|
645
|
+
SearchParams(index_uid=index2.uid, query=""),
|
|
646
|
+
],
|
|
647
|
+
)
|
|
648
|
+
|
|
649
|
+
assert response[0].performance_details is not None
|
|
650
|
+
assert response[1].performance_details is None
|
|
651
|
+
|
|
652
|
+
|
|
635
653
|
async def test_facet_search_ranking_score_threshold(async_index_with_documents_and_vectors):
|
|
636
654
|
index = await async_index_with_documents_and_vectors()
|
|
637
655
|
update = await index.update_filterable_attributes(["genre"])
|
|
@@ -703,3 +721,9 @@ async def test_search_show_matches_position(async_index_with_documents):
|
|
|
703
721
|
index = await async_index_with_documents()
|
|
704
722
|
response = await index.search("with", show_matches_position=True)
|
|
705
723
|
assert "_matchesPosition" in response.hits[0]
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
async def test_search_show_performance_parameters(async_index_with_documents):
|
|
727
|
+
index = await async_index_with_documents()
|
|
728
|
+
response = await index.search(show_performance_details=True)
|
|
729
|
+
assert response.performance_details is not None
|
|
@@ -1038,14 +1038,14 @@ def test_compact(client, index_with_documents):
|
|
|
1038
1038
|
def test_fields(index_with_documents):
|
|
1039
1039
|
index = index_with_documents()
|
|
1040
1040
|
result = index.fields()
|
|
1041
|
-
assert "genre" in [field.name for field in result]
|
|
1041
|
+
assert "genre" in [field.name for field in result.fields]
|
|
1042
1042
|
|
|
1043
1043
|
|
|
1044
1044
|
def test_fields_with_limit_and_offset(index_with_documents):
|
|
1045
1045
|
index = index_with_documents()
|
|
1046
1046
|
result = index.fields(limit=2, offset=2)
|
|
1047
|
-
assert len(result) == 2
|
|
1048
|
-
assert "overview" in [field.name for field in result]
|
|
1047
|
+
assert len(result.fields) == 2
|
|
1048
|
+
assert "overview" in [field.name for field in result.fields]
|
|
1049
1049
|
|
|
1050
1050
|
|
|
1051
1051
|
def test_fields_with_filter(client, index_with_documents):
|
|
@@ -1054,5 +1054,5 @@ def test_fields_with_filter(client, index_with_documents):
|
|
|
1054
1054
|
task = index.update_sortable_attributes(["title"])
|
|
1055
1055
|
client.wait_for_task(task.task_uid)
|
|
1056
1056
|
result = index.fields(filter=filter)
|
|
1057
|
-
assert len(result) == 1
|
|
1058
|
-
assert "title" in result[0].name
|
|
1057
|
+
assert len(result.fields) == 1
|
|
1058
|
+
assert "title" in result.fields[0].name
|
|
@@ -612,6 +612,24 @@ def test_multi_search_ranking_score_threshold(client, index_with_documents):
|
|
|
612
612
|
assert len(result[0].hits) > 0
|
|
613
613
|
|
|
614
614
|
|
|
615
|
+
def test_multi_search_show_performance_details(client, index_with_documents):
|
|
616
|
+
index1 = index_with_documents()
|
|
617
|
+
index2 = index_with_documents()
|
|
618
|
+
response = client.multi_search(
|
|
619
|
+
[
|
|
620
|
+
SearchParams(
|
|
621
|
+
index_uid=index1.uid,
|
|
622
|
+
query="How to Train Your Dragon",
|
|
623
|
+
show_performance_details=True,
|
|
624
|
+
),
|
|
625
|
+
SearchParams(index_uid=index2.uid, query=""),
|
|
626
|
+
],
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
assert response[0].performance_details is not None
|
|
630
|
+
assert response[1].performance_details is None
|
|
631
|
+
|
|
632
|
+
|
|
615
633
|
def test_facet_search_ranking_score_threshold(index_with_documents_and_vectors):
|
|
616
634
|
index = index_with_documents_and_vectors()
|
|
617
635
|
update = index.update_filterable_attributes(["genre"])
|
|
@@ -683,3 +701,9 @@ def test_search_show_matches_position(index_with_documents):
|
|
|
683
701
|
index = index_with_documents()
|
|
684
702
|
response = index.search("with", show_matches_position=True)
|
|
685
703
|
assert "_matchesPosition" in response.hits[0]
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
async def test_search_show_performance_parameters(async_index_with_documents):
|
|
707
|
+
index = await async_index_with_documents()
|
|
708
|
+
response = await index.search(show_performance_details=True)
|
|
709
|
+
assert response.performance_details is not None
|