mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01: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()?;
|
let mut iter = merger.into_stream_merger_iter()?;
|
||||||
while let Some((key, _)) = iter.next()? {
|
while let Some((key, _)) = iter.next()? {
|
||||||
let docid = key.try_into().map(DocumentId::from_be_bytes).unwrap();
|
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
|
// add generated embeddings
|
||||||
|
@ -170,29 +170,28 @@ impl ArroyWrapper {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delete an item from the index. It **does not** take care of fixing the hole
|
/// Delete all embeddings from a specific `item_id`
|
||||||
/// made after deleting the item.
|
pub fn del_items(
|
||||||
pub fn del_item_raw(
|
|
||||||
&self,
|
&self,
|
||||||
wtxn: &mut RwTxn,
|
wtxn: &mut RwTxn,
|
||||||
dimension: usize,
|
dimension: usize,
|
||||||
item_id: arroy::ItemId,
|
item_id: arroy::ItemId,
|
||||||
) -> Result<bool, arroy::Error> {
|
) -> Result<(), arroy::Error> {
|
||||||
for index in arroy_db_range_for_embedder(self.embedder_index) {
|
for index in arroy_db_range_for_embedder(self.embedder_index) {
|
||||||
if self.quantized {
|
if self.quantized {
|
||||||
let writer = arroy::Writer::new(self.quantized_db(), index, dimension);
|
let writer = arroy::Writer::new(self.quantized_db(), index, dimension);
|
||||||
if writer.del_item(wtxn, item_id)? {
|
if !writer.del_item(wtxn, item_id)? {
|
||||||
return Ok(true);
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let writer = arroy::Writer::new(self.angular_db(), index, dimension);
|
let writer = arroy::Writer::new(self.angular_db(), index, dimension);
|
||||||
if writer.del_item(wtxn, item_id)? {
|
if !writer.del_item(wtxn, item_id)? {
|
||||||
return Ok(true);
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(false)
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delete one item.
|
/// Delete one item.
|
||||||
|
Loading…
Reference in New Issue
Block a user