From 3503fbf7feeb7f71fdd6f4abd131ffefea78ec79 Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 28 Sep 2021 22:08:03 +0200 Subject: [PATCH] re-export milli from meilisearch_lib --- Cargo.lock | 1 - meilisearch-http/Cargo.toml | 1 - meilisearch-http/src/error.rs | 4 +++- meilisearch-http/src/routes/indexes/documents.rs | 2 +- meilisearch-http/src/routes/indexes/settings.rs | 2 +- meilisearch-http/src/routes/mod.rs | 2 +- meilisearch-lib/src/lib.rs | 2 ++ 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e763ecaa5..ec63e5020 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1678,7 +1678,6 @@ dependencies = [ "meilisearch-lib", "meilisearch-tokenizer", "memmap", - "milli", "mime", "mockall", "num_cpus", diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index 085a40b09..7875e5ae4 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -49,7 +49,6 @@ meilisearch-lib = { path = "../meilisearch-lib" } meilisearch-error = { path = "../meilisearch-error" } meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" } memmap = "0.7.0" -milli = { path = "../../milli/milli" } mime = "0.3.16" num_cpus = "1.13.0" once_cell = "1.8.0" diff --git a/meilisearch-http/src/error.rs b/meilisearch-http/src/error.rs index 00229960e..fb44b9a49 100644 --- a/meilisearch-http/src/error.rs +++ b/meilisearch-http/src/error.rs @@ -7,7 +7,7 @@ use actix_web::http::StatusCode; use actix_web::HttpResponseBuilder; use aweb::error::{JsonPayloadError, QueryPayloadError}; use meilisearch_error::{Code, ErrorCode}; -use milli::UserError; +use meilisearch_lib::milli; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone)] @@ -68,6 +68,8 @@ impl fmt::Display for MilliError<'_> { impl ErrorCode for MilliError<'_> { fn error_code(&self) -> Code { + use milli::UserError; + match self.0 { milli::Error::InternalError(_) => Code::Internal, milli::Error::IoError(_) => Code::Internal, diff --git a/meilisearch-http/src/routes/indexes/documents.rs b/meilisearch-http/src/routes/indexes/documents.rs index f7aa4f485..cf939bccd 100644 --- a/meilisearch-http/src/routes/indexes/documents.rs +++ b/meilisearch-http/src/routes/indexes/documents.rs @@ -5,7 +5,7 @@ use futures::{Stream, StreamExt}; use log::debug; use meilisearch_lib::MeiliSearch; use meilisearch_lib::index_controller::{DocumentAdditionFormat, Update}; -use milli::update::IndexDocumentsMethod; +use meilisearch_lib::milli::update::IndexDocumentsMethod; use serde::Deserialize; use serde_json::Value; use tokio::sync::mpsc; diff --git a/meilisearch-http/src/routes/indexes/settings.rs b/meilisearch-http/src/routes/indexes/settings.rs index 4a1e26426..24fd469d3 100644 --- a/meilisearch-http/src/routes/indexes/settings.rs +++ b/meilisearch-http/src/routes/indexes/settings.rs @@ -15,7 +15,7 @@ macro_rules! make_setting_route { use log::debug; use actix_web::{web, HttpResponse, Resource}; - use milli::update::Setting; + use meilisearch_lib::milli::update::Setting; use meilisearch_lib::{MeiliSearch, index::Settings, index_controller::Update}; use crate::error::ResponseError; diff --git a/meilisearch-http/src/routes/mod.rs b/meilisearch-http/src/routes/mod.rs index aa9847e23..3a5f84f18 100644 --- a/meilisearch-http/src/routes/mod.rs +++ b/meilisearch-http/src/routes/mod.rs @@ -50,7 +50,7 @@ pub enum UpdateType { impl From<&UpdateStatus> for UpdateType { fn from(other: &UpdateStatus) -> Self { - use milli::update::IndexDocumentsMethod::*; + use meilisearch_lib::milli::update::IndexDocumentsMethod::*; match other.meta() { Update::DocumentAddition{ method, .. } => { let number = match other { diff --git a/meilisearch-lib/src/lib.rs b/meilisearch-lib/src/lib.rs index 776a17f0d..3b7b5e7fa 100644 --- a/meilisearch-lib/src/lib.rs +++ b/meilisearch-lib/src/lib.rs @@ -7,6 +7,8 @@ pub mod index_controller; pub use index_controller::{IndexController as MeiliSearch, updates::store::Update}; +pub use milli; + mod compression; mod document_formats;