diff --git a/meilidb-http/src/routes/index.rs b/meilidb-http/src/routes/index.rs index 552f8d867..ff9a2998a 100644 --- a/meilidb-http/src/routes/index.rs +++ b/meilidb-http/src/routes/index.rs @@ -312,7 +312,7 @@ pub fn index_update_callback(index_uid: &str, data: &Data, _status: ProcessedUpd let mut writer = env.write_txn().unwrap(); data.compute_stats(&mut writer, &index_uid).unwrap(); - data.set_last_update(&mut writer, &index_uid).unwrap(); + data.set_last_update(&mut writer).unwrap(); writer.commit().unwrap(); } diff --git a/meilidb-http/src/routes/stats.rs b/meilidb-http/src/routes/stats.rs index 296f6f578..5d08f2073 100644 --- a/meilidb-http/src/routes/stats.rs +++ b/meilidb-http/src/routes/stats.rs @@ -1,6 +1,4 @@ use std::collections::HashMap; - -use chrono::{DateTime, Utc}; use pretty_bytes::converter::convert; use serde::Serialize; use sysinfo::{NetworkExt, Pid, ProcessExt, ProcessorExt, System, SystemExt}; @@ -17,7 +15,6 @@ use crate::Data; struct IndexStatsResponse { number_of_documents: u64, is_indexing: bool, - last_update: Option>, fields_frequency: HashMap, } @@ -34,9 +31,9 @@ pub async fn index_stat(ctx: Context) -> SResult { .number_of_documents(&reader) .map_err(ResponseError::internal)?; - let fields_frequency = ctx - .state() - .fields_frequency(&reader, &index_uid) + let fields_frequency = index + .main + .fields_frequency(&reader) .map_err(ResponseError::internal)? .unwrap_or_default(); @@ -46,15 +43,9 @@ pub async fn index_stat(ctx: Context) -> SResult { .map_err(ResponseError::internal)? .ok_or(ResponseError::not_found("Index not found"))?; - let last_update = ctx - .state() - .last_update(&reader, &index_uid) - .map_err(ResponseError::internal)?; - let response = IndexStatsResponse { number_of_documents, is_indexing, - last_update, fields_frequency, }; Ok(tide::response::json(response)) @@ -85,9 +76,9 @@ pub async fn get_stats(ctx: Context) -> SResult { .number_of_documents(&reader) .map_err(ResponseError::internal)?; - let fields_frequency = ctx - .state() - .fields_frequency(&reader, &index_uid) + let fields_frequency = index + .main + .fields_frequency(&reader) .map_err(ResponseError::internal)? .unwrap_or_default(); @@ -97,15 +88,9 @@ pub async fn get_stats(ctx: Context) -> SResult { .map_err(ResponseError::internal)? .ok_or(ResponseError::not_found("Index not found"))?; - let last_update = ctx - .state() - .last_update(&reader, &index_uid) - .map_err(ResponseError::internal)?; - let response = IndexStatsResponse { number_of_documents, is_indexing, - last_update, fields_frequency, }; index_list.insert(index_uid, response);