mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
Fix field distribution again
This commit is contained in:
parent
be395c7944
commit
de10f20732
@ -674,10 +674,7 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
total_documents: self.documents_count,
|
total_documents: self.documents_count,
|
||||||
});
|
});
|
||||||
|
|
||||||
// We increment all the field of the current document in the field distribution.
|
for (key, value) in KvReader::new(val) {
|
||||||
let obkv = KvReader::new(val);
|
|
||||||
|
|
||||||
for (key, value) in obkv.iter() {
|
|
||||||
let reader = KvReaderDelAdd::new(value);
|
let reader = KvReaderDelAdd::new(value);
|
||||||
match (reader.get(DelAdd::Deletion), reader.get(DelAdd::Addition)) {
|
match (reader.get(DelAdd::Deletion), reader.get(DelAdd::Addition)) {
|
||||||
(None, None) => {}
|
(None, None) => {}
|
||||||
@ -705,12 +702,14 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
BEntry::Occupied(mut entry) => {
|
BEntry::Occupied(mut entry) => {
|
||||||
// attempt to remove one
|
// attempt to remove one
|
||||||
match entry.get_mut().checked_sub(1) {
|
match entry.get_mut().checked_sub(1) {
|
||||||
|
Some(0) => {
|
||||||
|
entry.remove();
|
||||||
|
}
|
||||||
Some(new_val) => {
|
Some(new_val) => {
|
||||||
*entry.get_mut() = new_val;
|
*entry.get_mut() = new_val;
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
// was 0, remove field from distribution
|
unreachable!("Attempting to remove a field that wasn't in the field distribution")
|
||||||
entry.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user