mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
review changes
This commit is contained in:
parent
eb7616ca0f
commit
3ef0830c5d
@ -81,7 +81,7 @@ impl UpdateHandler {
|
|||||||
primary_key.as_deref(),
|
primary_key.as_deref(),
|
||||||
),
|
),
|
||||||
ClearDocuments => index.clear_documents(update_builder),
|
ClearDocuments => index.clear_documents(update_builder),
|
||||||
DeleteDocuments { documents } => index.delete_documents(documents.to_vec(), update_builder),
|
DeleteDocuments { ids } => index.delete_documents(ids, update_builder),
|
||||||
Settings(settings) => index.update_settings(&settings.clone().check(), update_builder),
|
Settings(settings) => index.update_settings(&settings.clone().check(), update_builder),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ impl Index {
|
|||||||
|
|
||||||
pub fn delete_documents(
|
pub fn delete_documents(
|
||||||
&self,
|
&self,
|
||||||
document_ids: Vec<String>,
|
document_ids: &[String],
|
||||||
update_builder: UpdateBuilder,
|
update_builder: UpdateBuilder,
|
||||||
) -> anyhow::Result<UpdateResult> {
|
) -> anyhow::Result<UpdateResult> {
|
||||||
let mut txn = self.write_txn()?;
|
let mut txn = self.write_txn()?;
|
||||||
|
@ -40,6 +40,8 @@ impl MapIndexStore {
|
|||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl IndexStore for MapIndexStore {
|
impl IndexStore for MapIndexStore {
|
||||||
async fn create(&self, uuid: Uuid, primary_key: Option<String>) -> IndexResult<Index> {
|
async fn create(&self, uuid: Uuid, primary_key: Option<String>) -> IndexResult<Index> {
|
||||||
|
// We need to keep the lock until we are sure the db file has been opened correclty, to
|
||||||
|
// ensure that another db is not created at the same time.
|
||||||
let mut lock = self.index_store.write().await;
|
let mut lock = self.index_store.write().await;
|
||||||
|
|
||||||
if let Some(index) = lock.get(&uuid) {
|
if let Some(index) = lock.get(&uuid) {
|
||||||
|
@ -203,7 +203,7 @@ impl IndexController {
|
|||||||
documents: Vec<String>,
|
documents: Vec<String>,
|
||||||
) -> anyhow::Result<UpdateStatus> {
|
) -> anyhow::Result<UpdateStatus> {
|
||||||
let uuid = self.uuid_resolver.get(uid).await?;
|
let uuid = self.uuid_resolver.get(uid).await?;
|
||||||
let meta = UpdateMeta::DeleteDocuments { documents };
|
let meta = UpdateMeta::DeleteDocuments { ids: documents };
|
||||||
let (_, receiver) = mpsc::channel(1);
|
let (_, receiver) = mpsc::channel(1);
|
||||||
let status = self.update_handle.update(meta, receiver, uuid).await?;
|
let status = self.update_handle.update(meta, receiver, uuid).await?;
|
||||||
Ok(status)
|
Ok(status)
|
||||||
|
@ -174,7 +174,7 @@ impl UpdateStore {
|
|||||||
Ok(Some(_)) => (),
|
Ok(Some(_)) => (),
|
||||||
Ok(None) => break,
|
Ok(None) => break,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Fatal error while processing update that requires the update store to shutdown: {}", e);
|
error!("Fatal error while processing an update that requires the update store to shutdown: {}", e);
|
||||||
must_exit.store(true, Ordering::SeqCst);
|
must_exit.store(true, Ordering::SeqCst);
|
||||||
break 'outer;
|
break 'outer;
|
||||||
}
|
}
|
||||||
@ -185,9 +185,9 @@ impl UpdateStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
error!("Update store loop exited.");
|
error!("Update store loop exited.");
|
||||||
|
});
|
||||||
|
|
||||||
Ok(update_store)
|
Ok(update_store)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ pub enum UpdateMeta {
|
|||||||
},
|
},
|
||||||
ClearDocuments,
|
ClearDocuments,
|
||||||
DeleteDocuments {
|
DeleteDocuments {
|
||||||
documents: Vec<String>
|
ids: Vec<String>
|
||||||
},
|
},
|
||||||
Settings(Settings<Unchecked>),
|
Settings(Settings<Unchecked>),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user