mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-09 21:14:30 +01:00
Fix new_incremental
This commit is contained in:
parent
46104a2836
commit
7813bc748a
@ -103,7 +103,6 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// need to find a new parent
|
// need to find a new parent
|
||||||
|
|
||||||
let parent_key_prefix = FacetGroupKey {
|
let parent_key_prefix = FacetGroupKey {
|
||||||
field_id: self.field_id,
|
field_id: self.field_id,
|
||||||
level: parent_level,
|
level: parent_level,
|
||||||
@ -154,16 +153,26 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
}
|
}
|
||||||
// remove old left bound
|
// remove old left bound
|
||||||
unsafe { it.del_current()? };
|
unsafe { it.del_current()? };
|
||||||
|
drop(it);
|
||||||
// pop all elements and order to visit the new left bound
|
// pop all elements and order to visit the new left bound
|
||||||
if let Some(first) = touched_children.last() {
|
touched_parents.push(child.clone());
|
||||||
touched_parents.push(first);
|
self.compute_parent_group(wtxn, child_level, child)?;
|
||||||
} else {
|
for child in touched_children {
|
||||||
touched_parents.push(child);
|
let new_left_bound = touched_parents.last_mut().unwrap();
|
||||||
|
new_left_bound.clear();
|
||||||
|
new_left_bound.extend_from_slice(&child);
|
||||||
|
self.compute_parent_group(wtxn, child_level, child)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(Err(err)) => return Err(err.into()),
|
Some(Err(err)) => return Err(err.into()),
|
||||||
// 2. max level reached, exit
|
// 2. max level reached, exit
|
||||||
None => {}
|
None => {
|
||||||
|
drop(it);
|
||||||
|
self.compute_parent_group(wtxn, child_level, child)?;
|
||||||
|
for child in touched_children {
|
||||||
|
self.compute_parent_group(wtxn, child_level, child)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.find_touched_parents(
|
self.find_touched_parents(
|
||||||
@ -264,11 +273,27 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
left_bound: range_left_bound.as_slice(),
|
left_bound: range_left_bound.as_slice(),
|
||||||
};
|
};
|
||||||
drop(child_it);
|
drop(child_it);
|
||||||
|
if let Bound::Included(_) = child_left_bound {
|
||||||
self.db.delete(wtxn, &update_key)?;
|
self.db.delete(wtxn, &update_key)?;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
drop(child_it);
|
||||||
let current_left_bound = group_left_bound.to_owned();
|
let current_left_bound = group_left_bound.to_owned();
|
||||||
|
|
||||||
|
let delete_old_bound = match child_left_bound {
|
||||||
|
Bound::Included(bound) => {
|
||||||
|
if bound.left_bound != current_left_bound {
|
||||||
|
Some(range_left_bound.clone())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
range_left_bound.clear();
|
range_left_bound.clear();
|
||||||
range_left_bound.extend_from_slice(right_bound);
|
range_left_bound.extend_from_slice(right_bound);
|
||||||
let child_left_key = FacetGroupKey {
|
let child_left_key = FacetGroupKey {
|
||||||
@ -277,7 +302,16 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
left_bound: range_left_bound.as_slice(),
|
left_bound: range_left_bound.as_slice(),
|
||||||
};
|
};
|
||||||
child_left_bound = Bound::Excluded(child_left_key);
|
child_left_bound = Bound::Excluded(child_left_key);
|
||||||
drop(child_it);
|
|
||||||
|
if let Some(old_bound) = delete_old_bound {
|
||||||
|
let update_key = FacetGroupKey {
|
||||||
|
field_id: self.field_id,
|
||||||
|
level: parent_level,
|
||||||
|
left_bound: old_bound.as_slice(),
|
||||||
|
};
|
||||||
|
self.db.delete(wtxn, &update_key)?;
|
||||||
|
}
|
||||||
|
|
||||||
let update_key = FacetGroupKey {
|
let update_key = FacetGroupKey {
|
||||||
field_id: self.field_id,
|
field_id: self.field_id,
|
||||||
level: parent_level,
|
level: parent_level,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user