meilisearch-python-sdk 4.3.0__py3-none-any.whl → 4.5.0__py3-none-any.whl
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/_client.py +111 -1
- meilisearch_python_sdk/_version.py +1 -1
- meilisearch_python_sdk/index.py +132 -15
- meilisearch_python_sdk/models/batch.py +3 -0
- meilisearch_python_sdk/models/client.py +11 -0
- meilisearch_python_sdk/models/settings.py +17 -1
- {meilisearch_python_sdk-4.3.0.dist-info → meilisearch_python_sdk-4.5.0.dist-info}/METADATA +1 -1
- {meilisearch_python_sdk-4.3.0.dist-info → meilisearch_python_sdk-4.5.0.dist-info}/RECORD +10 -10
- {meilisearch_python_sdk-4.3.0.dist-info → meilisearch_python_sdk-4.5.0.dist-info}/WHEEL +0 -0
- {meilisearch_python_sdk-4.3.0.dist-info → meilisearch_python_sdk-4.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -22,6 +22,7 @@ from meilisearch_python_sdk.models.client import (
|
|
|
22
22
|
KeyCreate,
|
|
23
23
|
KeySearch,
|
|
24
24
|
KeyUpdate,
|
|
25
|
+
Network,
|
|
25
26
|
)
|
|
26
27
|
from meilisearch_python_sdk.models.health import Health
|
|
27
28
|
from meilisearch_python_sdk.models.index import IndexInfo
|
|
@@ -196,12 +197,66 @@ class AsyncClient(BaseClient):
|
|
|
196
197
|
"""
|
|
197
198
|
await self.http_client.aclose()
|
|
198
199
|
|
|
200
|
+
async def add_or_update_networks(self, *, network: Network) -> Network:
|
|
201
|
+
"""Set or update remote networks.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
network: Information to use for the networks.
|
|
205
|
+
|
|
206
|
+
Returns:
|
|
207
|
+
An instance of Network containing the network information.
|
|
208
|
+
|
|
209
|
+
Raises:
|
|
210
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
211
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
212
|
+
|
|
213
|
+
Examples:
|
|
214
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
215
|
+
>>> from meilisearch_python_sdk.models.client import Network, Remote
|
|
216
|
+
>>>
|
|
217
|
+
>>>
|
|
218
|
+
>>> network = Network(
|
|
219
|
+
>>> self_="remote_1",
|
|
220
|
+
>>> remotes={
|
|
221
|
+
>>> "remote_1": {"url": "http://localhost:7700", "searchApiKey": "xxxx"},
|
|
222
|
+
>>> "remote_2": {"url": "http://localhost:7720", "searchApiKey": "xxxx"},
|
|
223
|
+
>>> },
|
|
224
|
+
>>> )
|
|
225
|
+
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
226
|
+
>>> response = await client.add_or_update_networks(network=network)
|
|
227
|
+
"""
|
|
228
|
+
response = await self._http_requests.patch(
|
|
229
|
+
"network", network.model_dump(by_alias=True, exclude_none=True)
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
return Network(**response.json())
|
|
233
|
+
|
|
234
|
+
async def get_networks(self) -> Network:
|
|
235
|
+
"""Fetches the remote-networks
|
|
236
|
+
|
|
237
|
+
Returns:
|
|
238
|
+
An instance of Network containing information about each remote.
|
|
239
|
+
|
|
240
|
+
Raises:
|
|
241
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
242
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
243
|
+
|
|
244
|
+
Examples:
|
|
245
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
246
|
+
>>>
|
|
247
|
+
>>>
|
|
248
|
+
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
249
|
+
>>> response = await client.get_networks()
|
|
250
|
+
"""
|
|
251
|
+
response = await self._http_requests.get("network")
|
|
252
|
+
|
|
253
|
+
return Network(**response.json())
|
|
254
|
+
|
|
199
255
|
async def create_dump(self) -> TaskInfo:
|
|
200
256
|
"""Trigger the creation of a Meilisearch dump.
|
|
201
257
|
|
|
202
258
|
Returns:
|
|
203
259
|
The details of the task.
|
|
204
|
-
|
|
205
260
|
Raises:
|
|
206
261
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
207
262
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
@@ -1061,6 +1116,61 @@ class Client(BaseClient):
|
|
|
1061
1116
|
|
|
1062
1117
|
self._http_requests = HttpRequests(self.http_client, json_handler=self.json_handler)
|
|
1063
1118
|
|
|
1119
|
+
def add_or_update_networks(self, *, network: Network) -> Network:
|
|
1120
|
+
"""Set or update remote networks.
|
|
1121
|
+
|
|
1122
|
+
Args:
|
|
1123
|
+
network: Information to use for the networks.
|
|
1124
|
+
|
|
1125
|
+
Returns:
|
|
1126
|
+
An instance of Network containing the network information.
|
|
1127
|
+
|
|
1128
|
+
Raises:
|
|
1129
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1130
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1131
|
+
|
|
1132
|
+
Examples:
|
|
1133
|
+
>>> from meilisearch_python_sdk import Client
|
|
1134
|
+
>>> from meilisearch_python_sdk.models.client import Network, Remote
|
|
1135
|
+
>>>
|
|
1136
|
+
>>>
|
|
1137
|
+
>>> network = Network(
|
|
1138
|
+
>>> self_="remote_1",
|
|
1139
|
+
>>> remotes={
|
|
1140
|
+
>>> "remote_1": {"url": "http://localhost:7700", "searchApiKey": "xxxx"},
|
|
1141
|
+
>>> "remote_2": {"url": "http://localhost:7720", "searchApiKey": "xxxx"},
|
|
1142
|
+
>>> },
|
|
1143
|
+
>>> )
|
|
1144
|
+
>>> client = Client("http://localhost.com", "masterKey")
|
|
1145
|
+
>>> response = client.add_or_update_networks(network=network)
|
|
1146
|
+
"""
|
|
1147
|
+
response = self._http_requests.patch(
|
|
1148
|
+
"network", network.model_dump(by_alias=True, exclude_none=True)
|
|
1149
|
+
)
|
|
1150
|
+
|
|
1151
|
+
return Network(**response.json())
|
|
1152
|
+
|
|
1153
|
+
def get_networks(self) -> Network:
|
|
1154
|
+
"""Fetches the remote-networks
|
|
1155
|
+
|
|
1156
|
+
Returns:
|
|
1157
|
+
An instance of Network containing information about each remote.
|
|
1158
|
+
|
|
1159
|
+
Raises:
|
|
1160
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1161
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1162
|
+
|
|
1163
|
+
Examples:
|
|
1164
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
1165
|
+
>>>
|
|
1166
|
+
>>>
|
|
1167
|
+
>>> client = Client("http://localhost.com", "masterKey")
|
|
1168
|
+
>>> response = client.get_networks()
|
|
1169
|
+
"""
|
|
1170
|
+
response = self._http_requests.get("network")
|
|
1171
|
+
|
|
1172
|
+
return Network(**response.json())
|
|
1173
|
+
|
|
1064
1174
|
def create_dump(self) -> TaskInfo:
|
|
1065
1175
|
"""Trigger the creation of a Meilisearch dump.
|
|
1066
1176
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "4.
|
|
1
|
+
VERSION = "4.5.0"
|
meilisearch_python_sdk/index.py
CHANGED
|
@@ -29,6 +29,8 @@ from meilisearch_python_sdk.models.search import (
|
|
|
29
29
|
from meilisearch_python_sdk.models.settings import (
|
|
30
30
|
Embedders,
|
|
31
31
|
Faceting,
|
|
32
|
+
FilterableAttributeFeatures,
|
|
33
|
+
FilterableAttributes,
|
|
32
34
|
HuggingFaceEmbedder,
|
|
33
35
|
LocalizedAttributes,
|
|
34
36
|
MeilisearchSettings,
|
|
@@ -990,6 +992,7 @@ class AsyncIndex(_BaseIndex):
|
|
|
990
992
|
vector: list[float] | None = None,
|
|
991
993
|
locales: list[str] | None = None,
|
|
992
994
|
retrieve_vectors: bool | None = None,
|
|
995
|
+
exhaustive_facet_count: bool | None = None,
|
|
993
996
|
) -> FacetSearchResults:
|
|
994
997
|
"""Search the index.
|
|
995
998
|
|
|
@@ -1043,6 +1046,9 @@ class AsyncIndex(_BaseIndex):
|
|
|
1043
1046
|
locales: Specifies the languages for the search. This parameter can only be used with
|
|
1044
1047
|
Milisearch >= v1.10.0. Defaults to None letting the Meilisearch pick.
|
|
1045
1048
|
retrieve_vectors: Return document vector data with search result.
|
|
1049
|
+
exhaustive_facet_count: forcing the facet search to compute the facet counts the same
|
|
1050
|
+
way as the paginated search. This parameter can only be used with Milisearch >=
|
|
1051
|
+
v1.14.0. Defaults to None.
|
|
1046
1052
|
|
|
1047
1053
|
Returns:
|
|
1048
1054
|
Results of the search
|
|
@@ -1091,6 +1097,7 @@ class AsyncIndex(_BaseIndex):
|
|
|
1091
1097
|
vector=vector,
|
|
1092
1098
|
locales=locales,
|
|
1093
1099
|
retrieve_vectors=retrieve_vectors,
|
|
1100
|
+
exhaustive_facet_count=exhaustive_facet_count,
|
|
1094
1101
|
)
|
|
1095
1102
|
search_url = f"{self._base_url_with_uid}/facet-search"
|
|
1096
1103
|
|
|
@@ -1120,6 +1127,7 @@ class AsyncIndex(_BaseIndex):
|
|
|
1120
1127
|
show_ranking_score_details=show_ranking_score_details,
|
|
1121
1128
|
ranking_score_threshold=ranking_score_threshold,
|
|
1122
1129
|
vector=vector,
|
|
1130
|
+
exhaustive_facet_count=exhaustive_facet_count,
|
|
1123
1131
|
)
|
|
1124
1132
|
|
|
1125
1133
|
if self._concurrent_facet_search_plugins:
|
|
@@ -1152,6 +1160,7 @@ class AsyncIndex(_BaseIndex):
|
|
|
1152
1160
|
show_ranking_score_details=show_ranking_score_details,
|
|
1153
1161
|
ranking_score_threshold=ranking_score_threshold,
|
|
1154
1162
|
vector=vector,
|
|
1163
|
+
exhaustive_facet_count=exhaustive_facet_count,
|
|
1155
1164
|
)
|
|
1156
1165
|
)
|
|
1157
1166
|
|
|
@@ -1195,6 +1204,7 @@ class AsyncIndex(_BaseIndex):
|
|
|
1195
1204
|
show_ranking_score_details=show_ranking_score_details,
|
|
1196
1205
|
ranking_score_threshold=ranking_score_threshold,
|
|
1197
1206
|
vector=vector,
|
|
1207
|
+
exhaustive_facet_count=exhaustive_facet_count,
|
|
1198
1208
|
)
|
|
1199
1209
|
)
|
|
1200
1210
|
|
|
@@ -1288,12 +1298,22 @@ class AsyncIndex(_BaseIndex):
|
|
|
1288
1298
|
|
|
1289
1299
|
return SimilarSearchResults[self.hits_type](**response.json()) # type: ignore[name-defined]
|
|
1290
1300
|
|
|
1291
|
-
async def get_document(
|
|
1301
|
+
async def get_document(
|
|
1302
|
+
self,
|
|
1303
|
+
document_id: str,
|
|
1304
|
+
*,
|
|
1305
|
+
fields: list[str] | None = None,
|
|
1306
|
+
retrieve_vectors: bool = False,
|
|
1307
|
+
) -> JsonDict:
|
|
1292
1308
|
"""Get one document with given document identifier.
|
|
1293
1309
|
|
|
1294
1310
|
Args:
|
|
1295
1311
|
document_id: Unique identifier of the document.
|
|
1296
|
-
|
|
1312
|
+
fields: Document attributes to show. If this value is None then all
|
|
1313
|
+
attributes are retrieved. Defaults to None.
|
|
1314
|
+
retrieve_vectors: If set to True the embedding vectors will be returned with the document.
|
|
1315
|
+
Defaults to False. Note: This parameter can only be
|
|
1316
|
+
used with Meilisearch >= v1.13.0
|
|
1297
1317
|
Returns:
|
|
1298
1318
|
The document information
|
|
1299
1319
|
|
|
@@ -1307,7 +1327,16 @@ class AsyncIndex(_BaseIndex):
|
|
|
1307
1327
|
>>> index = client.index("movies")
|
|
1308
1328
|
>>> document = await index.get_document("1234")
|
|
1309
1329
|
"""
|
|
1310
|
-
|
|
1330
|
+
parameters: JsonDict = {}
|
|
1331
|
+
|
|
1332
|
+
if fields:
|
|
1333
|
+
parameters["fields"] = ",".join(fields)
|
|
1334
|
+
if retrieve_vectors:
|
|
1335
|
+
parameters["retrieveVectors"] = "true"
|
|
1336
|
+
|
|
1337
|
+
url = _build_encoded_url(f"{self._documents_url}/{document_id}", parameters)
|
|
1338
|
+
|
|
1339
|
+
response = await self._http_requests.get(url)
|
|
1311
1340
|
|
|
1312
1341
|
return response.json()
|
|
1313
1342
|
|
|
@@ -1318,6 +1347,7 @@ class AsyncIndex(_BaseIndex):
|
|
|
1318
1347
|
limit: int = 20,
|
|
1319
1348
|
fields: list[str] | None = None,
|
|
1320
1349
|
filter: Filter | None = None,
|
|
1350
|
+
retrieve_vectors: bool = False,
|
|
1321
1351
|
) -> DocumentsInfo:
|
|
1322
1352
|
"""Get a batch documents from the index.
|
|
1323
1353
|
|
|
@@ -1328,6 +1358,9 @@ class AsyncIndex(_BaseIndex):
|
|
|
1328
1358
|
attributes are retrieved. Defaults to None.
|
|
1329
1359
|
filter: Filter value information. Defaults to None. Note: This parameter can only be
|
|
1330
1360
|
used with Meilisearch >= v1.2.0
|
|
1361
|
+
retrieve_vectors: If set to True the vectors will be returned with each document.
|
|
1362
|
+
Defaults to False. Note: This parameter can only be
|
|
1363
|
+
used with Meilisearch >= v1.13.0
|
|
1331
1364
|
|
|
1332
1365
|
Returns:
|
|
1333
1366
|
Documents info.
|
|
@@ -1348,6 +1381,9 @@ class AsyncIndex(_BaseIndex):
|
|
|
1348
1381
|
"limit": limit,
|
|
1349
1382
|
}
|
|
1350
1383
|
|
|
1384
|
+
if retrieve_vectors:
|
|
1385
|
+
parameters["retrieveVectors"] = "true"
|
|
1386
|
+
|
|
1351
1387
|
if not filter:
|
|
1352
1388
|
if fields:
|
|
1353
1389
|
parameters["fields"] = ",".join(fields)
|
|
@@ -3542,11 +3578,11 @@ class AsyncIndex(_BaseIndex):
|
|
|
3542
3578
|
|
|
3543
3579
|
return TaskInfo(**response.json())
|
|
3544
3580
|
|
|
3545
|
-
async def get_filterable_attributes(self) -> list[str] | None:
|
|
3581
|
+
async def get_filterable_attributes(self) -> list[str] | list[FilterableAttributes] | None:
|
|
3546
3582
|
"""Get filterable attributes of the index.
|
|
3547
3583
|
|
|
3548
3584
|
Returns:
|
|
3549
|
-
|
|
3585
|
+
Filterable attributes of the index.
|
|
3550
3586
|
|
|
3551
3587
|
Raises:
|
|
3552
3588
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
@@ -3563,10 +3599,24 @@ class AsyncIndex(_BaseIndex):
|
|
|
3563
3599
|
if not response.json():
|
|
3564
3600
|
return None
|
|
3565
3601
|
|
|
3566
|
-
|
|
3602
|
+
response_json = response.json()
|
|
3603
|
+
|
|
3604
|
+
if isinstance(response_json[0], str):
|
|
3605
|
+
return response_json
|
|
3606
|
+
|
|
3607
|
+
filterable_attributes = []
|
|
3608
|
+
for r in response_json:
|
|
3609
|
+
filterable_attributes.append(
|
|
3610
|
+
FilterableAttributes(
|
|
3611
|
+
attribute_patterns=r["attributePatterns"],
|
|
3612
|
+
features=FilterableAttributeFeatures(**r["features"]),
|
|
3613
|
+
)
|
|
3614
|
+
)
|
|
3615
|
+
|
|
3616
|
+
return filterable_attributes
|
|
3567
3617
|
|
|
3568
3618
|
async def update_filterable_attributes(
|
|
3569
|
-
self, body: list[str], *, compress: bool = False
|
|
3619
|
+
self, body: list[str] | list[FilterableAttributes], *, compress: bool = False
|
|
3570
3620
|
) -> TaskInfo:
|
|
3571
3621
|
"""Update filterable attributes of the index.
|
|
3572
3622
|
|
|
@@ -3587,8 +3637,16 @@ class AsyncIndex(_BaseIndex):
|
|
|
3587
3637
|
>>> index = client.index("movies")
|
|
3588
3638
|
>>> await index.update_filterable_attributes(["genre", "director"])
|
|
3589
3639
|
"""
|
|
3640
|
+
payload: list[str | JsonDict] = []
|
|
3641
|
+
|
|
3642
|
+
for b in body:
|
|
3643
|
+
if isinstance(b, FilterableAttributes):
|
|
3644
|
+
payload.append(b.model_dump(by_alias=True))
|
|
3645
|
+
else:
|
|
3646
|
+
payload.append(b)
|
|
3647
|
+
|
|
3590
3648
|
response = await self._http_requests.put(
|
|
3591
|
-
f"{self._settings_url}/filterable-attributes",
|
|
3649
|
+
f"{self._settings_url}/filterable-attributes", payload, compress=compress
|
|
3592
3650
|
)
|
|
3593
3651
|
|
|
3594
3652
|
return TaskInfo(**response.json())
|
|
@@ -5266,6 +5324,7 @@ class Index(_BaseIndex):
|
|
|
5266
5324
|
vector: list[float] | None = None,
|
|
5267
5325
|
locales: list[str] | None = None,
|
|
5268
5326
|
retrieve_vectors: bool | None = None,
|
|
5327
|
+
exhaustive_facet_count: bool | None = None,
|
|
5269
5328
|
) -> FacetSearchResults:
|
|
5270
5329
|
"""Search the index.
|
|
5271
5330
|
|
|
@@ -5319,6 +5378,9 @@ class Index(_BaseIndex):
|
|
|
5319
5378
|
locales: Specifies the languages for the search. This parameter can only be used with
|
|
5320
5379
|
Milisearch >= v1.10.0. Defaults to None letting the Meilisearch pick.
|
|
5321
5380
|
retrieve_vectors: Return document vector data with search result.
|
|
5381
|
+
exhaustive_facet_count: forcing the facet search to compute the facet counts the same
|
|
5382
|
+
way as the paginated search. This parameter can only be used with Milisearch >=
|
|
5383
|
+
v1.14.0. Defaults to None.
|
|
5322
5384
|
|
|
5323
5385
|
Returns:
|
|
5324
5386
|
Results of the search
|
|
@@ -5367,6 +5429,7 @@ class Index(_BaseIndex):
|
|
|
5367
5429
|
vector=vector,
|
|
5368
5430
|
locales=locales,
|
|
5369
5431
|
retrieve_vectors=retrieve_vectors,
|
|
5432
|
+
exhaustive_facet_count=exhaustive_facet_count,
|
|
5370
5433
|
)
|
|
5371
5434
|
|
|
5372
5435
|
if self._pre_facet_search_plugins:
|
|
@@ -5395,6 +5458,7 @@ class Index(_BaseIndex):
|
|
|
5395
5458
|
show_ranking_score_details=show_ranking_score_details,
|
|
5396
5459
|
ranking_score_threshold=ranking_score_threshold,
|
|
5397
5460
|
vector=vector,
|
|
5461
|
+
exhaustive_facet_count=exhaustive_facet_count,
|
|
5398
5462
|
)
|
|
5399
5463
|
|
|
5400
5464
|
response = self._http_requests.post(f"{self._base_url_with_uid}/facet-search", body=body)
|
|
@@ -5470,12 +5534,22 @@ class Index(_BaseIndex):
|
|
|
5470
5534
|
|
|
5471
5535
|
return SimilarSearchResults[self.hits_type](**response.json()) # type: ignore[name-defined]
|
|
5472
5536
|
|
|
5473
|
-
def get_document(
|
|
5537
|
+
def get_document(
|
|
5538
|
+
self,
|
|
5539
|
+
document_id: str,
|
|
5540
|
+
*,
|
|
5541
|
+
fields: list[str] | None = None,
|
|
5542
|
+
retrieve_vectors: bool = False,
|
|
5543
|
+
) -> JsonDict:
|
|
5474
5544
|
"""Get one document with given document identifier.
|
|
5475
5545
|
|
|
5476
5546
|
Args:
|
|
5477
5547
|
document_id: Unique identifier of the document.
|
|
5478
|
-
|
|
5548
|
+
fields: Document attributes to show. If this value is None then all
|
|
5549
|
+
attributes are retrieved. Defaults to None.
|
|
5550
|
+
retrieve_vectors: If set to True the embedding vectors will be returned with the document.
|
|
5551
|
+
Defaults to False. Note: This parameter can only be
|
|
5552
|
+
used with Meilisearch >= v1.13.0
|
|
5479
5553
|
Returns:
|
|
5480
5554
|
The document information
|
|
5481
5555
|
|
|
@@ -5489,8 +5563,16 @@ class Index(_BaseIndex):
|
|
|
5489
5563
|
>>> index = client.index("movies")
|
|
5490
5564
|
>>> document = index.get_document("1234")
|
|
5491
5565
|
"""
|
|
5492
|
-
|
|
5566
|
+
parameters: JsonDict = {}
|
|
5493
5567
|
|
|
5568
|
+
if fields:
|
|
5569
|
+
parameters["fields"] = ",".join(fields)
|
|
5570
|
+
if retrieve_vectors:
|
|
5571
|
+
parameters["retrieveVectors"] = "true"
|
|
5572
|
+
|
|
5573
|
+
url = _build_encoded_url(f"{self._documents_url}/{document_id}", parameters)
|
|
5574
|
+
|
|
5575
|
+
response = self._http_requests.get(url)
|
|
5494
5576
|
return response.json()
|
|
5495
5577
|
|
|
5496
5578
|
def get_documents(
|
|
@@ -5500,6 +5582,7 @@ class Index(_BaseIndex):
|
|
|
5500
5582
|
limit: int = 20,
|
|
5501
5583
|
fields: list[str] | None = None,
|
|
5502
5584
|
filter: Filter | None = None,
|
|
5585
|
+
retrieve_vectors: bool = False,
|
|
5503
5586
|
) -> DocumentsInfo:
|
|
5504
5587
|
"""Get a batch documents from the index.
|
|
5505
5588
|
|
|
@@ -5510,6 +5593,9 @@ class Index(_BaseIndex):
|
|
|
5510
5593
|
attributes are retrieved. Defaults to None.
|
|
5511
5594
|
filter: Filter value information. Defaults to None. Note: This parameter can only be
|
|
5512
5595
|
used with Meilisearch >= v1.2.0
|
|
5596
|
+
retrieve_vectors: If set to True the vectors will be returned with each document.
|
|
5597
|
+
Defaults to False. Note: This parameter can only be
|
|
5598
|
+
used with Meilisearch >= v1.13.0
|
|
5513
5599
|
|
|
5514
5600
|
Returns:
|
|
5515
5601
|
Documents info.
|
|
@@ -5530,6 +5616,9 @@ class Index(_BaseIndex):
|
|
|
5530
5616
|
"limit": limit,
|
|
5531
5617
|
}
|
|
5532
5618
|
|
|
5619
|
+
if retrieve_vectors:
|
|
5620
|
+
parameters["retrieveVectors"] = "true"
|
|
5621
|
+
|
|
5533
5622
|
if not filter:
|
|
5534
5623
|
if fields:
|
|
5535
5624
|
parameters["fields"] = ",".join(fields)
|
|
@@ -7105,7 +7194,7 @@ class Index(_BaseIndex):
|
|
|
7105
7194
|
|
|
7106
7195
|
return TaskInfo(**response.json())
|
|
7107
7196
|
|
|
7108
|
-
def get_filterable_attributes(self) -> list[str] | None:
|
|
7197
|
+
def get_filterable_attributes(self) -> list[str] | list[FilterableAttributes] | None:
|
|
7109
7198
|
"""Get filterable attributes of the index.
|
|
7110
7199
|
|
|
7111
7200
|
Returns:
|
|
@@ -7126,9 +7215,25 @@ class Index(_BaseIndex):
|
|
|
7126
7215
|
if not response.json():
|
|
7127
7216
|
return None
|
|
7128
7217
|
|
|
7129
|
-
|
|
7218
|
+
response_json = response.json()
|
|
7219
|
+
|
|
7220
|
+
if isinstance(response_json[0], str):
|
|
7221
|
+
return response_json
|
|
7222
|
+
|
|
7223
|
+
filterable_attributes = []
|
|
7224
|
+
for r in response_json:
|
|
7225
|
+
filterable_attributes.append(
|
|
7226
|
+
FilterableAttributes(
|
|
7227
|
+
attribute_patterns=r["attributePatterns"],
|
|
7228
|
+
features=FilterableAttributeFeatures(**r["features"]),
|
|
7229
|
+
)
|
|
7230
|
+
)
|
|
7231
|
+
|
|
7232
|
+
return filterable_attributes
|
|
7130
7233
|
|
|
7131
|
-
def update_filterable_attributes(
|
|
7234
|
+
def update_filterable_attributes(
|
|
7235
|
+
self, body: list[str] | list[FilterableAttributes], *, compress: bool = False
|
|
7236
|
+
) -> TaskInfo:
|
|
7132
7237
|
"""Update filterable attributes of the index.
|
|
7133
7238
|
|
|
7134
7239
|
Args:
|
|
@@ -7148,8 +7253,16 @@ class Index(_BaseIndex):
|
|
|
7148
7253
|
>>> index = client.index("movies")
|
|
7149
7254
|
>>> index.update_filterable_attributes(["genre", "director"])
|
|
7150
7255
|
"""
|
|
7256
|
+
payload: list[str | JsonDict] = []
|
|
7257
|
+
|
|
7258
|
+
for b in body:
|
|
7259
|
+
if isinstance(b, FilterableAttributes):
|
|
7260
|
+
payload.append(b.model_dump(by_alias=True))
|
|
7261
|
+
else:
|
|
7262
|
+
payload.append(b)
|
|
7263
|
+
|
|
7151
7264
|
response = self._http_requests.put(
|
|
7152
|
-
f"{self._settings_url}/filterable-attributes",
|
|
7265
|
+
f"{self._settings_url}/filterable-attributes", payload, compress=compress
|
|
7153
7266
|
)
|
|
7154
7267
|
|
|
7155
7268
|
return TaskInfo(**response.json())
|
|
@@ -8275,6 +8388,7 @@ def _process_search_parameters(
|
|
|
8275
8388
|
hybrid: Hybrid | None = None,
|
|
8276
8389
|
locales: list[str] | None = None,
|
|
8277
8390
|
retrieve_vectors: bool | None = None,
|
|
8391
|
+
exhaustive_facet_count: bool | None = None,
|
|
8278
8392
|
) -> JsonDict:
|
|
8279
8393
|
if attributes_to_retrieve is None:
|
|
8280
8394
|
attributes_to_retrieve = ["*"]
|
|
@@ -8326,6 +8440,9 @@ def _process_search_parameters(
|
|
|
8326
8440
|
if retrieve_vectors is not None:
|
|
8327
8441
|
body["retrieveVectors"] = retrieve_vectors
|
|
8328
8442
|
|
|
8443
|
+
if exhaustive_facet_count is not None:
|
|
8444
|
+
body["exhaustivefacetCount"] = exhaustive_facet_count
|
|
8445
|
+
|
|
8329
8446
|
return body
|
|
8330
8447
|
|
|
8331
8448
|
|
|
@@ -26,6 +26,9 @@ class Stats(CamelBase):
|
|
|
26
26
|
status: Status
|
|
27
27
|
batch_types: JsonDict | None = Field(None, alias="types")
|
|
28
28
|
index_uids: JsonDict | None = None
|
|
29
|
+
progress_trace: JsonDict | None = None
|
|
30
|
+
write_channel_congestion: JsonDict | None = None
|
|
31
|
+
internal_database_sizes: JsonDict | None = None
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
class BatchResult(BatchId):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from collections.abc import Mapping
|
|
3
4
|
from datetime import datetime
|
|
4
5
|
|
|
5
6
|
import pydantic
|
|
@@ -84,3 +85,13 @@ class KeySearch(CamelBase):
|
|
|
84
85
|
offset: int
|
|
85
86
|
limit: int
|
|
86
87
|
total: int
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Remote(CamelBase):
|
|
91
|
+
url: str | None = None
|
|
92
|
+
search_api_key: str | None = None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class Network(CamelBase):
|
|
96
|
+
self_: str | None = pydantic.Field(None, alias="self")
|
|
97
|
+
remotes: Mapping[str, Remote] | None = None
|
|
@@ -68,6 +68,7 @@ class HuggingFaceEmbedder(CamelBase):
|
|
|
68
68
|
distribution: Distribution | None = None
|
|
69
69
|
dimensions: int | None = None
|
|
70
70
|
binary_quantized: bool | None = None
|
|
71
|
+
pooling: Literal["useModel", "forceMean", "forceCls"] | None = None
|
|
71
72
|
|
|
72
73
|
|
|
73
74
|
class OllamaEmbedder(CamelBase):
|
|
@@ -122,11 +123,26 @@ class LocalizedAttributes(CamelBase):
|
|
|
122
123
|
attribute_patterns: list[str]
|
|
123
124
|
|
|
124
125
|
|
|
126
|
+
class Filter(CamelBase):
|
|
127
|
+
equality: bool
|
|
128
|
+
comparison: bool
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class FilterableAttributeFeatures(CamelBase):
|
|
132
|
+
facet_search: bool
|
|
133
|
+
filter: Filter
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class FilterableAttributes(CamelBase):
|
|
137
|
+
attribute_patterns: list[str]
|
|
138
|
+
features: FilterableAttributeFeatures
|
|
139
|
+
|
|
140
|
+
|
|
125
141
|
class MeilisearchSettings(CamelBase):
|
|
126
142
|
synonyms: JsonDict | None = None
|
|
127
143
|
stop_words: list[str] | None = None
|
|
128
144
|
ranking_rules: list[str] | None = None
|
|
129
|
-
filterable_attributes: list[str] | None = None
|
|
145
|
+
filterable_attributes: list[str] | list[FilterableAttributes] | None = None
|
|
130
146
|
distinct_attribute: str | None = None
|
|
131
147
|
searchable_attributes: list[str] | None = None
|
|
132
148
|
displayed_attributes: list[str] | None = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meilisearch-python-sdk
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.5.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
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
meilisearch_python_sdk/__init__.py,sha256=SB0Jlm6FwT13J9xasZKseZzTWBk0hkfe1CWyWmIIZnE,258
|
|
2
2
|
meilisearch_python_sdk/_batch.py,sha256=Hbt-M8Lt8ZDZqcKToUMzUd5zvT-gku709er4pRlvXWk,5065
|
|
3
|
-
meilisearch_python_sdk/_client.py,sha256=
|
|
3
|
+
meilisearch_python_sdk/_client.py,sha256=KsQkSoZEAnXK2H0QWc-tOOczOAE8kuLUssxmd5j9dS4,77379
|
|
4
4
|
meilisearch_python_sdk/_http_requests.py,sha256=O3M3n-t1jAKwccWowPbk-HPD3ExtHq8a3XhnZT5facs,6746
|
|
5
5
|
meilisearch_python_sdk/_task.py,sha256=QgVcqMlZdURRS_oYpB_bTBa5dvT3Sp_-O0-s6TqAxHk,12485
|
|
6
6
|
meilisearch_python_sdk/_utils.py,sha256=NoCDxJPhjABeuSxFTNCih585UDWdXEUBD_FvdgtScQw,1539
|
|
7
|
-
meilisearch_python_sdk/_version.py,sha256=
|
|
7
|
+
meilisearch_python_sdk/_version.py,sha256=ME22OuDO9PfD0DD625X6HDtDkXBo2w6KB54pVLm8Es0,18
|
|
8
8
|
meilisearch_python_sdk/decorators.py,sha256=njMn40P-qOzKGGQLCDpsBKWyj2ai10s4XG4IUBSHoD4,8674
|
|
9
9
|
meilisearch_python_sdk/errors.py,sha256=RNNHXtXLBiCVZaLM2MeKKs9RbRuE-SLRttiPeVAEXgA,2133
|
|
10
|
-
meilisearch_python_sdk/index.py,sha256=
|
|
10
|
+
meilisearch_python_sdk/index.py,sha256=GcgLdA-uTSXXagtsEz6-oiEEF8uT7-xPYWQSN8rN2ug,347083
|
|
11
11
|
meilisearch_python_sdk/json_handler.py,sha256=c1rGKzYlE0dGfLygQjPqVUNfQkN1JvafBGmIx31JW8g,2044
|
|
12
12
|
meilisearch_python_sdk/plugins.py,sha256=YySzTuVr4IrogTgrP8q-gZPsew8TwedopjWnTj5eV48,3607
|
|
13
13
|
meilisearch_python_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
meilisearch_python_sdk/types.py,sha256=WxbQBPfy5S_j9hRKJ74ktuIxkH9Oifn7GYStQjs49Ik,458
|
|
15
15
|
meilisearch_python_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
meilisearch_python_sdk/models/batch.py,sha256=
|
|
17
|
-
meilisearch_python_sdk/models/client.py,sha256=
|
|
16
|
+
meilisearch_python_sdk/models/batch.py,sha256=PYnJxCB_rvOaGM4Z-EFgxHqTaFct_s8djlCXkaa1V8k,1613
|
|
17
|
+
meilisearch_python_sdk/models/client.py,sha256=nefi6ViSaSd_mtopRAhM9tzzepwChFJUkGTXPAr4RY8,2756
|
|
18
18
|
meilisearch_python_sdk/models/documents.py,sha256=eT3FHrPND-g2IzNRyOHQApTTJ1WbFcGlqgxZ6aKrRgI,247
|
|
19
19
|
meilisearch_python_sdk/models/health.py,sha256=hvruti7ylsk7bAh8RPOhTPcRrjx6MPgdkDFX9vZ5Qks,95
|
|
20
20
|
meilisearch_python_sdk/models/index.py,sha256=WLQOi3_HChko134FkRU1H3_cJjhHJCFclcx4oDBlqHU,1228
|
|
21
21
|
meilisearch_python_sdk/models/search.py,sha256=ZySZyA18QuJavz82gK7Kkqfp0fIxWVervCw24W6bToA,3487
|
|
22
|
-
meilisearch_python_sdk/models/settings.py,sha256=
|
|
22
|
+
meilisearch_python_sdk/models/settings.py,sha256=j76M4EUGNOLnSICH9yhUcYpGadjD8BU2OjBPy4GvhyM,4860
|
|
23
23
|
meilisearch_python_sdk/models/task.py,sha256=_PyuH5tSlHCKMwFsx1nMKjFgc8bDBZxscKYZOdf-4pg,2166
|
|
24
24
|
meilisearch_python_sdk/models/version.py,sha256=YDu-aj5H-d6nSaWRTXzlwWghmZAoiknaw250UyEd48I,215
|
|
25
|
-
meilisearch_python_sdk-4.
|
|
26
|
-
meilisearch_python_sdk-4.
|
|
27
|
-
meilisearch_python_sdk-4.
|
|
28
|
-
meilisearch_python_sdk-4.
|
|
25
|
+
meilisearch_python_sdk-4.5.0.dist-info/METADATA,sha256=wiJj4P5bQlsCLy1byIKhlYxtKDxR0orDWE2JLHv0_pE,9763
|
|
26
|
+
meilisearch_python_sdk-4.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
27
|
+
meilisearch_python_sdk-4.5.0.dist-info/licenses/LICENSE,sha256=xVzevI1TrlKfM0plmJ7vfK1Muu0V9n-dGE8RnDrOFlM,1069
|
|
28
|
+
meilisearch_python_sdk-4.5.0.dist-info/RECORD,,
|
|
File without changes
|
{meilisearch_python_sdk-4.3.0.dist-info → meilisearch_python_sdk-4.5.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|