mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
documetn addition and search
This commit is contained in:
parent
74410d8c6b
commit
8183202868
6 changed files with 79 additions and 36 deletions
|
@ -61,7 +61,12 @@ impl Data {
|
|||
let path = options.db_path.clone();
|
||||
let indexer_opts = options.indexer_options.clone();
|
||||
create_dir_all(&path)?;
|
||||
let index_controller = LocalIndexController::new(&path, indexer_opts)?;
|
||||
let index_controller = LocalIndexController::new(
|
||||
&path,
|
||||
indexer_opts,
|
||||
options.max_mdb_size.get_bytes(),
|
||||
options.max_udb_size.get_bytes(),
|
||||
)?;
|
||||
let indexes = Arc::new(index_controller);
|
||||
|
||||
let mut api_keys = ApiKeys {
|
||||
|
|
|
@ -6,7 +6,8 @@ use futures_util::stream::StreamExt;
|
|||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
use super::Data;
|
||||
use crate::index_controller::{IndexController, UpdateStatusResponse, Settings};
|
||||
use crate::index_controller::{IndexController, Settings, UpdateResult, UpdateMeta};
|
||||
use crate::index_controller::updates::UpdateStatus;
|
||||
|
||||
impl Data {
|
||||
pub async fn add_documents<B, E, S>(
|
||||
|
@ -15,7 +16,7 @@ impl Data {
|
|||
method: IndexDocumentsMethod,
|
||||
format: UpdateFormat,
|
||||
mut stream: impl futures::Stream<Item=Result<B, E>> + Unpin,
|
||||
) -> anyhow::Result<UpdateStatusResponse>
|
||||
) -> anyhow::Result<UpdateStatus<UpdateMeta, UpdateResult, String>>
|
||||
where
|
||||
B: Deref<Target = [u8]>,
|
||||
E: std::error::Error + Send + Sync + 'static,
|
||||
|
@ -45,7 +46,7 @@ impl Data {
|
|||
&self,
|
||||
index: S,
|
||||
settings: Settings
|
||||
) -> anyhow::Result<UpdateStatusResponse> {
|
||||
) -> anyhow::Result<UpdateStatus<UpdateMeta, UpdateResult, String>> {
|
||||
let indexes = self.index_controller.clone();
|
||||
let update = tokio::task::spawn_blocking(move || indexes.update_settings(index, settings)).await??;
|
||||
Ok(update.into())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue