mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
Introduce the UpdateBuilder type along with some update operations
This commit is contained in:
parent
adacc7977d
commit
b14cca2ad9
9 changed files with 382 additions and 39 deletions
|
@ -340,7 +340,8 @@ where F: Fn(u32, u32) + Sync + Send,
|
|||
// to first delete the replaced documents for example.
|
||||
let mut wtxn = env.write_txn()?;
|
||||
|
||||
let contains_documents = index.documents_ids(&wtxn)?.map_or(false, |docids| !docids.is_empty());
|
||||
let mut documents_ids = index.documents_ids(&wtxn)?;
|
||||
let contains_documents = !documents_ids.is_empty();
|
||||
let write_method = if contains_documents {
|
||||
WriteMethod::GetMergePut
|
||||
} else {
|
||||
|
@ -354,13 +355,8 @@ where F: Fn(u32, u32) + Sync + Send,
|
|||
index.put_users_ids_documents_ids(&mut wtxn, &users_ids_documents_ids)?;
|
||||
|
||||
// We merge the new documents ids with the existing ones.
|
||||
match index.documents_ids(&wtxn)? {
|
||||
Some(mut documents_ids) => {
|
||||
documents_ids.union_with(&new_documents_ids);
|
||||
index.put_documents_ids(&mut wtxn, &documents_ids)?;
|
||||
},
|
||||
None => index.put_documents_ids(&mut wtxn, &new_documents_ids)?,
|
||||
}
|
||||
documents_ids.union_with(&new_documents_ids);
|
||||
index.put_documents_ids(&mut wtxn, &documents_ids)?;
|
||||
|
||||
debug!("Writing the docid word positions into LMDB on disk...");
|
||||
merge_into_lmdb_database(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue