mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 07:56:28 +00:00 
			
		
		
		
	Use set indexer options instead of create a default one
This commit is contained in:
		| @@ -31,9 +31,12 @@ pub struct IndexActor<S> { | ||||
| } | ||||
|  | ||||
| impl<S: IndexStore + Sync + Send> IndexActor<S> { | ||||
|     pub fn new(receiver: mpsc::Receiver<IndexMsg>, store: S) -> anyhow::Result<Self> { | ||||
|         let options = IndexerOpts::default(); | ||||
|         let update_handler = UpdateHandler::new(&options)?; | ||||
|     pub fn new( | ||||
|         receiver: mpsc::Receiver<IndexMsg>, | ||||
|         store: S, | ||||
|         options: &IndexerOpts, | ||||
|     ) -> anyhow::Result<Self> { | ||||
|         let update_handler = UpdateHandler::new(options)?; | ||||
|         let update_handler = Arc::new(update_handler); | ||||
|         let receiver = Some(receiver); | ||||
|         Ok(Self { | ||||
|   | ||||
| @@ -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<Path>, index_size: usize) -> anyhow::Result<Self> { | ||||
|     pub fn new( | ||||
|         path: impl AsRef<Path>, | ||||
|         index_size: usize, | ||||
|         options: &IndexerOpts, | ||||
|     ) -> anyhow::Result<Self> { | ||||
|         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 }) | ||||
|     } | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user