convert the field_distribution to a BTreeMap and avoid counting twice the same documents

This commit is contained in:
Tamo
2021-06-17 17:05:34 +02:00
parent 969adaefdf
commit d08cfda796
4 changed files with 70 additions and 12 deletions

View File

@ -14,7 +14,7 @@ pub mod tree_level;
pub mod update;
use std::borrow::Cow;
use std::collections::HashMap;
use std::collections::{BTreeMap, HashMap};
use std::hash::BuildHasherDefault;
use std::result::Result as StdResult;
@ -50,7 +50,7 @@ pub type Attribute = u32;
pub type DocumentId = u32;
pub type FieldId = u8;
pub type Position = u32;
pub type FieldsDistribution = HashMap<String, u64>;
pub type FieldsDistribution = BTreeMap<String, u64>;
type MergeFn<E> = for<'a> fn(&[u8], &[Cow<'a, [u8]>]) -> StdResult<Vec<u8>, E>;