meilisearch-python-sdk 2.2.3__tar.gz → 2.4.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.
Potentially problematic release.
This version of meilisearch-python-sdk might be problematic. Click here for more details.
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/PKG-INFO +1 -1
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/_client.py +50 -12
- meilisearch_python_sdk-2.4.0/meilisearch_python_sdk/_version.py +1 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/index.py +1591 -40
- meilisearch_python_sdk-2.4.0/meilisearch_python_sdk/plugins.py +122 -0
- meilisearch_python_sdk-2.4.0/meilisearch_python_sdk/types.py +5 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/pyproject.toml +1 -1
- meilisearch_python_sdk-2.2.3/meilisearch_python_sdk/_version.py +0 -1
- meilisearch_python_sdk-2.2.3/meilisearch_python_sdk/types.py +0 -5
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/LICENSE +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/README.md +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/__init__.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/_http_requests.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/_task.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/_utils.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/decorators.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/errors.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/__init__.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/client.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/documents.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/health.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/index.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/search.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/settings.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/task.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/models/version.py +0 -0
- {meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/py.typed +0 -0
{meilisearch_python_sdk-2.2.3 → meilisearch_python_sdk-2.4.0}/meilisearch_python_sdk/_client.py
RENAMED
|
@@ -25,8 +25,10 @@ from meilisearch_python_sdk.models.client import (
|
|
|
25
25
|
from meilisearch_python_sdk.models.health import Health
|
|
26
26
|
from meilisearch_python_sdk.models.index import IndexInfo
|
|
27
27
|
from meilisearch_python_sdk.models.search import SearchParams, SearchResultsWithUID
|
|
28
|
+
from meilisearch_python_sdk.models.settings import MeilisearchSettings
|
|
28
29
|
from meilisearch_python_sdk.models.task import TaskInfo, TaskResult, TaskStatus
|
|
29
30
|
from meilisearch_python_sdk.models.version import Version
|
|
31
|
+
from meilisearch_python_sdk.plugins import AsyncIndexPlugins, IndexPlugins
|
|
30
32
|
from meilisearch_python_sdk.types import JsonDict, JsonMapping
|
|
31
33
|
|
|
32
34
|
|
|
@@ -185,13 +187,26 @@ class AsyncClient(BaseClient):
|
|
|
185
187
|
|
|
186
188
|
return TaskInfo(**response.json())
|
|
187
189
|
|
|
188
|
-
async def create_index(
|
|
190
|
+
async def create_index(
|
|
191
|
+
self,
|
|
192
|
+
uid: str,
|
|
193
|
+
primary_key: str | None = None,
|
|
194
|
+
*,
|
|
195
|
+
settings: MeilisearchSettings | None = None,
|
|
196
|
+
plugins: AsyncIndexPlugins | None = None,
|
|
197
|
+
) -> AsyncIndex:
|
|
189
198
|
"""Creates a new index.
|
|
190
199
|
|
|
191
200
|
Args:
|
|
192
201
|
|
|
193
202
|
uid: The index's unique identifier.
|
|
194
203
|
primary_key: The primary key of the documents. Defaults to None.
|
|
204
|
+
settings: Settings for the index. The settings can also be updated independently of
|
|
205
|
+
creating the index. The advantage to updating them here is updating the settings after
|
|
206
|
+
adding documents will cause the documents to be re-indexed. Because of this it will be
|
|
207
|
+
faster to update them before adding documents. Defaults to None (i.e. default
|
|
208
|
+
Meilisearch index settings).
|
|
209
|
+
plugins: Optional plugins can be provided to extend functionality.
|
|
195
210
|
|
|
196
211
|
Returns:
|
|
197
212
|
|
|
@@ -208,7 +223,9 @@ class AsyncClient(BaseClient):
|
|
|
208
223
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
209
224
|
>>> index = await client.create_index("movies")
|
|
210
225
|
"""
|
|
211
|
-
return await AsyncIndex.create(
|
|
226
|
+
return await AsyncIndex.create(
|
|
227
|
+
self.http_client, uid, primary_key, settings=settings, plugins=plugins
|
|
228
|
+
)
|
|
212
229
|
|
|
213
230
|
async def create_snapshot(self) -> TaskInfo:
|
|
214
231
|
"""Trigger the creation of a Meilisearch snapshot.
|
|
@@ -327,7 +344,7 @@ class AsyncClient(BaseClient):
|
|
|
327
344
|
"""
|
|
328
345
|
return await AsyncIndex(self.http_client, uid).fetch_info()
|
|
329
346
|
|
|
330
|
-
def index(self, uid: str) -> AsyncIndex:
|
|
347
|
+
def index(self, uid: str, *, plugins: AsyncIndexPlugins | None = None) -> AsyncIndex:
|
|
331
348
|
"""Create a local reference to an index identified by UID, without making an HTTP call.
|
|
332
349
|
|
|
333
350
|
Because no network call is made this method is not awaitable.
|
|
@@ -335,6 +352,7 @@ class AsyncClient(BaseClient):
|
|
|
335
352
|
Args:
|
|
336
353
|
|
|
337
354
|
uid: The index's unique identifier.
|
|
355
|
+
plugins: Optional plugins can be provided to extend functionality.
|
|
338
356
|
|
|
339
357
|
Returns:
|
|
340
358
|
|
|
@@ -351,7 +369,7 @@ class AsyncClient(BaseClient):
|
|
|
351
369
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
352
370
|
>>> index = client.index("movies")
|
|
353
371
|
"""
|
|
354
|
-
return AsyncIndex(self.http_client, uid=uid)
|
|
372
|
+
return AsyncIndex(self.http_client, uid=uid, plugins=plugins)
|
|
355
373
|
|
|
356
374
|
async def get_all_stats(self) -> ClientStats:
|
|
357
375
|
"""Get stats for all indexes.
|
|
@@ -376,13 +394,16 @@ class AsyncClient(BaseClient):
|
|
|
376
394
|
|
|
377
395
|
return ClientStats(**response.json())
|
|
378
396
|
|
|
379
|
-
async def get_or_create_index(
|
|
397
|
+
async def get_or_create_index(
|
|
398
|
+
self, uid: str, primary_key: str | None = None, *, plugins: AsyncIndexPlugins | None = None
|
|
399
|
+
) -> AsyncIndex:
|
|
380
400
|
"""Get an index, or create it if it doesn't exist.
|
|
381
401
|
|
|
382
402
|
Args:
|
|
383
403
|
|
|
384
404
|
uid: The index's unique identifier.
|
|
385
405
|
primary_key: The primary key of the documents. Defaults to None.
|
|
406
|
+
plugins: Optional plugins can be provided to extend functionality.
|
|
386
407
|
|
|
387
408
|
Returns:
|
|
388
409
|
|
|
@@ -405,7 +426,7 @@ class AsyncClient(BaseClient):
|
|
|
405
426
|
except MeilisearchApiError as err:
|
|
406
427
|
if "index_not_found" not in err.code:
|
|
407
428
|
raise
|
|
408
|
-
index_instance = await self.create_index(uid, primary_key)
|
|
429
|
+
index_instance = await self.create_index(uid, primary_key, plugins=plugins)
|
|
409
430
|
return index_instance
|
|
410
431
|
|
|
411
432
|
async def create_key(self, key: KeyCreate) -> Key:
|
|
@@ -1021,13 +1042,26 @@ class Client(BaseClient):
|
|
|
1021
1042
|
|
|
1022
1043
|
return TaskInfo(**response.json())
|
|
1023
1044
|
|
|
1024
|
-
def create_index(
|
|
1045
|
+
def create_index(
|
|
1046
|
+
self,
|
|
1047
|
+
uid: str,
|
|
1048
|
+
primary_key: str | None = None,
|
|
1049
|
+
*,
|
|
1050
|
+
settings: MeilisearchSettings | None = None,
|
|
1051
|
+
plugins: IndexPlugins | None = None,
|
|
1052
|
+
) -> Index:
|
|
1025
1053
|
"""Creates a new index.
|
|
1026
1054
|
|
|
1027
1055
|
Args:
|
|
1028
1056
|
|
|
1029
1057
|
uid: The index's unique identifier.
|
|
1030
1058
|
primary_key: The primary key of the documents. Defaults to None.
|
|
1059
|
+
settings: Settings for the index. The settings can also be updated independently of
|
|
1060
|
+
creating the index. The advantage to updating them here is updating the settings after
|
|
1061
|
+
adding documents will cause the documents to be re-indexed. Because of this it will be
|
|
1062
|
+
faster to update them before adding documents. Defaults to None (i.e. default
|
|
1063
|
+
Meilisearch index settings).
|
|
1064
|
+
plugins: Optional plugins can be provided to extend functionality.
|
|
1031
1065
|
|
|
1032
1066
|
Returns:
|
|
1033
1067
|
|
|
@@ -1044,7 +1078,7 @@ class Client(BaseClient):
|
|
|
1044
1078
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1045
1079
|
>>> index = client.create_index("movies")
|
|
1046
1080
|
"""
|
|
1047
|
-
return Index.create(self.http_client, uid, primary_key)
|
|
1081
|
+
return Index.create(self.http_client, uid, primary_key, settings=settings, plugins=plugins)
|
|
1048
1082
|
|
|
1049
1083
|
def create_snapshot(self) -> TaskInfo:
|
|
1050
1084
|
"""Trigger the creation of a Meilisearch snapshot.
|
|
@@ -1163,12 +1197,13 @@ class Client(BaseClient):
|
|
|
1163
1197
|
"""
|
|
1164
1198
|
return Index(self.http_client, uid).fetch_info()
|
|
1165
1199
|
|
|
1166
|
-
def index(self, uid: str) -> Index:
|
|
1200
|
+
def index(self, uid: str, *, plugins: IndexPlugins | None = None) -> Index:
|
|
1167
1201
|
"""Create a local reference to an index identified by UID, without making an HTTP call.
|
|
1168
1202
|
|
|
1169
1203
|
Args:
|
|
1170
1204
|
|
|
1171
1205
|
uid: The index's unique identifier.
|
|
1206
|
+
plugins: Optional plugins can be provided to extend functionality.
|
|
1172
1207
|
|
|
1173
1208
|
Returns:
|
|
1174
1209
|
|
|
@@ -1185,7 +1220,7 @@ class Client(BaseClient):
|
|
|
1185
1220
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1186
1221
|
>>> index = client.index("movies")
|
|
1187
1222
|
"""
|
|
1188
|
-
return Index(self.http_client, uid=uid)
|
|
1223
|
+
return Index(self.http_client, uid=uid, plugins=plugins)
|
|
1189
1224
|
|
|
1190
1225
|
def get_all_stats(self) -> ClientStats:
|
|
1191
1226
|
"""Get stats for all indexes.
|
|
@@ -1210,13 +1245,16 @@ class Client(BaseClient):
|
|
|
1210
1245
|
|
|
1211
1246
|
return ClientStats(**response.json())
|
|
1212
1247
|
|
|
1213
|
-
def get_or_create_index(
|
|
1248
|
+
def get_or_create_index(
|
|
1249
|
+
self, uid: str, primary_key: str | None = None, *, plugins: IndexPlugins | None = None
|
|
1250
|
+
) -> Index:
|
|
1214
1251
|
"""Get an index, or create it if it doesn't exist.
|
|
1215
1252
|
|
|
1216
1253
|
Args:
|
|
1217
1254
|
|
|
1218
1255
|
uid: The index's unique identifier.
|
|
1219
1256
|
primary_key: The primary key of the documents. Defaults to None.
|
|
1257
|
+
plugins: Optional plugins can be provided to extend functionality.
|
|
1220
1258
|
|
|
1221
1259
|
Returns:
|
|
1222
1260
|
|
|
@@ -1239,7 +1277,7 @@ class Client(BaseClient):
|
|
|
1239
1277
|
except MeilisearchApiError as err:
|
|
1240
1278
|
if "index_not_found" not in err.code:
|
|
1241
1279
|
raise
|
|
1242
|
-
index_instance = self.create_index(uid, primary_key)
|
|
1280
|
+
index_instance = self.create_index(uid, primary_key, plugins=plugins)
|
|
1243
1281
|
return index_instance
|
|
1244
1282
|
|
|
1245
1283
|
def create_key(self, key: KeyCreate) -> Key:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "2.4.0"
|