mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 10:07:40 +08:00
early exit in the clear and contains
This commit is contained in:
parent
8b4e2c7b17
commit
7f048b9732
@ -251,9 +251,17 @@ impl ArroyWrapper {
|
||||
pub fn clear(&self, wtxn: &mut RwTxn, dimension: usize) -> Result<(), arroy::Error> {
|
||||
for index in arroy_db_range_for_embedder(self.embedder_index) {
|
||||
if self.quantized {
|
||||
arroy::Writer::new(self.quantized_db(), index, dimension).clear(wtxn)?;
|
||||
let writer = arroy::Writer::new(self.quantized_db(), index, dimension);
|
||||
if writer.is_empty(wtxn)? {
|
||||
break;
|
||||
}
|
||||
writer.clear(wtxn)?;
|
||||
} else {
|
||||
arroy::Writer::new(self.angular_db(), index, dimension).clear(wtxn)?;
|
||||
let writer = arroy::Writer::new(self.angular_db(), index, dimension);
|
||||
if writer.is_empty(wtxn)? {
|
||||
break;
|
||||
}
|
||||
writer.clear(wtxn)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@ -267,10 +275,17 @@ impl ArroyWrapper {
|
||||
) -> Result<bool, arroy::Error> {
|
||||
for index in arroy_db_range_for_embedder(self.embedder_index) {
|
||||
let contains = if self.quantized {
|
||||
arroy::Writer::new(self.quantized_db(), index, dimension)
|
||||
.contains_item(rtxn, item)?
|
||||
let writer = arroy::Writer::new(self.quantized_db(), index, dimension);
|
||||
if writer.is_empty(rtxn)? {
|
||||
break;
|
||||
}
|
||||
writer.contains_item(rtxn, item)?
|
||||
} else {
|
||||
arroy::Writer::new(self.angular_db(), index, dimension).contains_item(rtxn, item)?
|
||||
let writer = arroy::Writer::new(self.angular_db(), index, dimension);
|
||||
if writer.is_empty(rtxn)? {
|
||||
break;
|
||||
}
|
||||
writer.contains_item(rtxn, item)?
|
||||
};
|
||||
if contains {
|
||||
return Ok(contains);
|
||||
|
Loading…
Reference in New Issue
Block a user