mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 19:45:05 +08:00
fix the del items thing
This commit is contained in:
parent
f2d187ba3e
commit
fd8447c521
@ -680,7 +680,7 @@ pub(crate) fn write_typed_chunk_into_index(
|
||||
let mut iter = merger.into_stream_merger_iter()?;
|
||||
while let Some((key, _)) = iter.next()? {
|
||||
let docid = key.try_into().map(DocumentId::from_be_bytes).unwrap();
|
||||
writer.del_item_raw(wtxn, expected_dimension, docid)?;
|
||||
writer.del_items(wtxn, expected_dimension, docid)?;
|
||||
}
|
||||
|
||||
// add generated embeddings
|
||||
|
@ -170,29 +170,28 @@ impl ArroyWrapper {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete an item from the index. It **does not** take care of fixing the hole
|
||||
/// made after deleting the item.
|
||||
pub fn del_item_raw(
|
||||
/// Delete all embeddings from a specific `item_id`
|
||||
pub fn del_items(
|
||||
&self,
|
||||
wtxn: &mut RwTxn,
|
||||
dimension: usize,
|
||||
item_id: arroy::ItemId,
|
||||
) -> Result<bool, arroy::Error> {
|
||||
) -> Result<(), arroy::Error> {
|
||||
for index in arroy_db_range_for_embedder(self.embedder_index) {
|
||||
if self.quantized {
|
||||
let writer = arroy::Writer::new(self.quantized_db(), index, dimension);
|
||||
if writer.del_item(wtxn, item_id)? {
|
||||
return Ok(true);
|
||||
if !writer.del_item(wtxn, item_id)? {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
let writer = arroy::Writer::new(self.angular_db(), index, dimension);
|
||||
if writer.del_item(wtxn, item_id)? {
|
||||
return Ok(true);
|
||||
if !writer.del_item(wtxn, item_id)? {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(false)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete one item.
|
||||
|
Loading…
Reference in New Issue
Block a user