Search for items within a namespace prefix.
search_items(
self,
namespace_prefix: Sequence[str],
,
filter: Mapping[str, Any] | None = None,
limit: int = 10,
offset: int = 0,
query: str | None = None,
refresh_ttl: bool | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None
) -> SearchItemsResponseclient = get_client(url="http://localhost:2024")
items = await client.store.search_items(
["documents"],
filter={"author": "John Doe"},
limit=5,
offset=0
)
print(items)
----------------------------------------------------------------
{
"items": [
{
"namespace": ["documents", "user123"],
"key": "item789",
"value": {
"title": "Another Document",
"author": "John Doe"
},
"created_at": "2024-07-30T12:00:00Z",
"updated_at": "2024-07-30T12:00:00Z"
},
# ... additional items ...
]
}| Name | Type | Description |
|---|---|---|
namespace_prefix* | Sequence[str] | List of strings representing the namespace prefix. |
filter | Mapping[str, Any] | None | Default: NoneOptional dictionary of key-value pairs to filter results. |
limit | int | Default: 10Maximum number of items to return (default is 10). |
offset | int | Default: 0Number of items to skip before returning results (default is 0). |
query | str | None | Default: NoneOptional query for natural language search. |
refresh_ttl | bool | None | Default: NoneWhether to refresh the TTL on items returned by this search. If |
headers | Mapping[str, str] | None | Default: NoneOptional custom headers to include with the request. |
params | QueryParamTypes | None | Default: NoneOptional query parameters to include with the request. |