plug the new batchers into the documents route

This commit is contained in:
Tamo 2021-10-25 19:28:30 +02:00 committed by marin postma
parent 9be90011c6
commit ba14ea1243
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9

View File

@ -8,7 +8,7 @@ use meilisearch_lib::milli::update::IndexDocumentsMethod;
use meilisearch_lib::MeiliSearch; use meilisearch_lib::MeiliSearch;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde::Deserialize; use serde::Deserialize;
use serde_json::{json, Value}; use serde_json::Value;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use crate::analytics::Analytics; use crate::analytics::Analytics;
@ -141,14 +141,10 @@ pub async fn add_documents(
.map(|s| s.to_str().unwrap_or("unkown")); .map(|s| s.to_str().unwrap_or("unkown"));
let params = params.into_inner(); let params = params.into_inner();
analytics.publish( analytics.add_documents(
"Documents Added".to_string(), &params,
json!({ meilisearch.get_index(path.index_uid.clone()).await.is_ok(),
"payload_type": content_type, &req,
"with_primary_key": params.primary_key,
"index_creation": meilisearch.get_index(path.index_uid.clone()).await.is_ok(),
}),
Some(&req),
); );
document_addition( document_addition(
@ -176,14 +172,10 @@ pub async fn update_documents(
.get("Content-type") .get("Content-type")
.map(|s| s.to_str().unwrap_or("unkown")); .map(|s| s.to_str().unwrap_or("unkown"));
analytics.publish( analytics.update_documents(
"Documents Updated".to_string(), &params,
json!({ meilisearch.get_index(path.index_uid.clone()).await.is_ok(),
"payload_type": content_type, &req,
"with_primary_key": params.primary_key,
"index_creation": meilisearch.get_index(path.index_uid.clone()).await.is_ok(),
}),
Some(&req),
); );
document_addition( document_addition(