mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +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> {
|
pub fn clear(&self, wtxn: &mut RwTxn, dimension: usize) -> 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 {
|
||||||
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 {
|
} 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(())
|
Ok(())
|
||||||
@ -267,10 +275,17 @@ impl ArroyWrapper {
|
|||||||
) -> Result<bool, arroy::Error> {
|
) -> Result<bool, arroy::Error> {
|
||||||
for index in arroy_db_range_for_embedder(self.embedder_index) {
|
for index in arroy_db_range_for_embedder(self.embedder_index) {
|
||||||
let contains = if self.quantized {
|
let contains = if self.quantized {
|
||||||
arroy::Writer::new(self.quantized_db(), index, dimension)
|
let writer = arroy::Writer::new(self.quantized_db(), index, dimension);
|
||||||
.contains_item(rtxn, item)?
|
if writer.is_empty(rtxn)? {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
writer.contains_item(rtxn, item)?
|
||||||
} else {
|
} 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 {
|
if contains {
|
||||||
return Ok(contains);
|
return Ok(contains);
|
||||||
|
Loading…
Reference in New Issue
Block a user