Skip to content

Commit 6ba586e

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 6ba586e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/client.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,10 @@ 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+
#[serde(default)]
1158+
pub used_database_size: Option<usize>,
11571159

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

src/indexes.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,10 +1900,14 @@ 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+
#[serde(default)]
1905+
pub number_of_embedded_documents: Option<usize>,
19041906

19051907
/// Total number of embeddings in an index
1906-
pub number_of_embeddings: usize,
1908+
/// Is `None` for Meilisearch servers older than 1.13.
1909+
#[serde(default)]
1910+
pub number_of_embeddings: Option<usize>,
19071911

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

0 commit comments

Comments
 (0)