From 08138c7c236c153d8dfc8ef109f7d151900ba714 Mon Sep 17 00:00:00 2001 From: many Date: Wed, 8 Sep 2021 10:44:23 +0200 Subject: [PATCH] Use set indexer options instead of create a default one --- .../src/index_controller/index_actor/actor.rs | 9 ++++++--- .../src/index_controller/index_actor/handle_impl.rs | 9 +++++++-- meilisearch-http/src/index_controller/mod.rs | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/meilisearch-http/src/index_controller/index_actor/actor.rs b/meilisearch-http/src/index_controller/index_actor/actor.rs index 15d96b7ad..fc40a5090 100644 --- a/meilisearch-http/src/index_controller/index_actor/actor.rs +++ b/meilisearch-http/src/index_controller/index_actor/actor.rs @@ -31,9 +31,12 @@ pub struct IndexActor { } impl IndexActor { - pub fn new(receiver: mpsc::Receiver, store: S) -> anyhow::Result { - let options = IndexerOpts::default(); - let update_handler = UpdateHandler::new(&options)?; + pub fn new( + receiver: mpsc::Receiver, + store: S, + options: &IndexerOpts, + ) -> anyhow::Result { + let update_handler = UpdateHandler::new(options)?; let update_handler = Arc::new(update_handler); let receiver = Some(receiver); Ok(Self { diff --git a/meilisearch-http/src/index_controller/index_actor/handle_impl.rs b/meilisearch-http/src/index_controller/index_actor/handle_impl.rs index 231a3a44b..ceb2a8226 100644 --- a/meilisearch-http/src/index_controller/index_actor/handle_impl.rs +++ b/meilisearch-http/src/index_controller/index_actor/handle_impl.rs @@ -1,3 +1,4 @@ +use crate::option::IndexerOpts; use std::path::{Path, PathBuf}; use tokio::sync::{mpsc, oneshot}; @@ -148,11 +149,15 @@ impl IndexActorHandle for IndexActorHandleImpl { } impl IndexActorHandleImpl { - pub fn new(path: impl AsRef, index_size: usize) -> anyhow::Result { + pub fn new( + path: impl AsRef, + index_size: usize, + options: &IndexerOpts, + ) -> anyhow::Result { let (sender, receiver) = mpsc::channel(100); let store = MapIndexStore::new(path, index_size); - let actor = IndexActor::new(receiver, store)?; + let actor = IndexActor::new(receiver, store, options)?; tokio::task::spawn(actor.run()); Ok(Self { sender }) } diff --git a/meilisearch-http/src/index_controller/mod.rs b/meilisearch-http/src/index_controller/mod.rs index a90498b9c..83a97cd8f 100644 --- a/meilisearch-http/src/index_controller/mod.rs +++ b/meilisearch-http/src/index_controller/mod.rs @@ -110,7 +110,8 @@ impl IndexController { std::fs::create_dir_all(&path)?; let uuid_resolver = uuid_resolver::UuidResolverHandleImpl::new(&path)?; - let index_handle = index_actor::IndexActorHandleImpl::new(&path, index_size)?; + let index_handle = + index_actor::IndexActorHandleImpl::new(&path, index_size, &options.indexer_options)?; let update_handle = update_actor::UpdateActorHandleImpl::new( index_handle.clone(), &path,