cargo fmt

This commit is contained in:
qdequele 2020-08-17 17:03:57 +02:00 committed by qdequele
parent 2644f087d0
commit 0a67248bfe
2 changed files with 15 additions and 9 deletions

View file

@ -3,14 +3,14 @@ use std::collections::{BTreeSet, HashSet};
use actix_web::{delete, get, post, put};
use actix_web::{web, HttpResponse};
use indexmap::IndexMap;
use meilisearch_core::{update, MainReader};
use meilisearch_core::{update, Index};
use serde_json::Value;
use serde::Deserialize;
use crate::Data;
use crate::error::{Error, ResponseError};
use crate::helpers::Authentication;
use crate::routes::{IndexParam, IndexUpdateResponse};
use crate::Data;
type Document = IndexMap<String, Value>;
@ -45,7 +45,8 @@ async fn get_document(
let reader = data.db.main_read_txn()?;
let internal_id = index.main
let internal_id = index
.main
.external_to_internal_docid(&reader, &path.document_id)?
.ok_or(Error::document_not_found(&path.document_id))?;
@ -189,6 +190,7 @@ fn create_index(data: &Data, uid: &str) -> Result<Index, ResponseError> {
Ok(created_index)
}
async fn update_multiple_documents(
data: web::Data<Data>,
path: web::Path<IndexParam>,
@ -215,12 +217,10 @@ async fn update_multiple_documents(
None => body
.first()
.and_then(find_primary_key)
.ok_or(meilisearch_core::Error::MissingPrimaryKey)?
.ok_or(meilisearch_core::Error::MissingPrimaryKey)?,
};
schema
.set_primary_key(&id)
.map_err(Error::bad_request)?;
schema.set_primary_key(&id).map_err(Error::bad_request)?;
data.db.main_write(|w| index.main.put_schema(w, &schema))?;
}
@ -274,7 +274,6 @@ async fn delete_documents(
.open_index(&path.index_uid)
.ok_or(Error::index_not_found(&path.index_uid))?;
let mut documents_deletion = index.documents_deletion();
for document_id in body.into_inner() {