Skip to content

Commit 1ae5cc2

Browse files
Make some fields in *Stats structs optional to support older servers
These three fields were added in 1.13. If you want to support older servers, these fields need to be optional. https://github.com/meilisearch/meilisearch/releases/tag/v1.13.0
1 parent 5dd4375 commit 1ae5cc2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,9 @@ pub struct ClientStats {
11521152
/// Storage space claimed by Meilisearch and LMDB in bytes
11531153
pub database_size: usize,
11541154

1155-
/// Storage space used by the database in bytes, excluding unused space claimed by LMDB
1156-
pub used_database_size: usize,
1155+
/// Storage space used by the database in bytes, excluding unused space claimed by LMDB.
1156+
/// Is `None` for Meilisearch servers older than 1.13.
1157+
pub used_database_size: Option<usize>,
11571158

11581159
/// When the last update was made to the database in the `RFC 3339` format
11591160
#[serde(with = "time::serde::rfc3339::option")]

src/indexes.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,10 +1900,12 @@ pub struct IndexStats {
19001900
pub number_of_documents: usize,
19011901

19021902
/// Total number of documents with at least one embedding
1903-
pub number_of_embedded_documents: usize,
1903+
/// Is `None` for Meilisearch servers older than 1.13.
1904+
pub number_of_embedded_documents: Option<usize>,
19041905

19051906
/// Total number of embeddings in an index
1906-
pub number_of_embeddings: usize,
1907+
/// Is `None` for Meilisearch servers older than 1.13.
1908+
pub number_of_embeddings: Option<usize>,
19071909

19081910
/// Storage space claimed by all documents in the index in bytes
19091911
pub raw_document_db_size: usize,

0 commit comments

Comments
 (0)