From daef43f504ccbe1efa3f03f6f2480aa0bf39fbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar?= Date: Mon, 21 Jun 2021 15:57:41 +0200 Subject: [PATCH] Rename FieldsDistribution into FieldDistribution --- milli/src/index.rs | 10 +++++----- milli/src/lib.rs | 2 +- milli/src/update/clear_documents.rs | 4 ++-- milli/src/update/index_documents/transform.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/milli/src/index.rs b/milli/src/index.rs index 2faf8d1f8..8982154e5 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -16,7 +16,7 @@ use crate::heed_codec::facet::{ use crate::{ default_criteria, BEU32StrCodec, BoRoaringBitmapCodec, CboRoaringBitmapCodec, Criterion, DocumentId, ExternalDocumentsIds, FacetDistribution, FieldId, FieldIdWordCountCodec, - FieldsDistribution, ObkvCodec, Result, RoaringBitmapCodec, RoaringBitmapLenCodec, Search, + FieldDistribution, ObkvCodec, Result, RoaringBitmapCodec, RoaringBitmapLenCodec, Search, StrLevelPositionCodec, StrStrU8Codec, BEU32, }; @@ -297,9 +297,9 @@ impl Index { pub(crate) fn put_field_distribution( &self, wtxn: &mut RwTxn, - distribution: &FieldsDistribution, + distribution: &FieldDistribution, ) -> heed::Result<()> { - self.main.put::<_, Str, SerdeJson>( + self.main.put::<_, Str, SerdeJson>( wtxn, main_key::FIELD_DISTRIBUTION_KEY, distribution, @@ -308,10 +308,10 @@ impl Index { /// Returns the field distribution which associates every field name with /// the number of times it occurs in the documents. - pub fn field_distribution(&self, rtxn: &RoTxn) -> heed::Result { + pub fn field_distribution(&self, rtxn: &RoTxn) -> heed::Result { Ok(self .main - .get::<_, Str, SerdeJson>(rtxn, main_key::FIELD_DISTRIBUTION_KEY)? + .get::<_, Str, SerdeJson>(rtxn, main_key::FIELD_DISTRIBUTION_KEY)? .unwrap_or_default()) } diff --git a/milli/src/lib.rs b/milli/src/lib.rs index e88ac62d5..ec9bc32c6 100644 --- a/milli/src/lib.rs +++ b/milli/src/lib.rs @@ -50,7 +50,7 @@ pub type Attribute = u32; pub type DocumentId = u32; pub type FieldId = u8; pub type Position = u32; -pub type FieldsDistribution = BTreeMap; +pub type FieldDistribution = BTreeMap; type MergeFn = for<'a> fn(&[u8], &[Cow<'a, [u8]>]) -> StdResult, E>; diff --git a/milli/src/update/clear_documents.rs b/milli/src/update/clear_documents.rs index dbb932bfe..789970a8e 100644 --- a/milli/src/update/clear_documents.rs +++ b/milli/src/update/clear_documents.rs @@ -1,7 +1,7 @@ use chrono::Utc; use roaring::RoaringBitmap; -use crate::{ExternalDocumentsIds, FieldsDistribution, Index, Result}; +use crate::{ExternalDocumentsIds, FieldDistribution, Index, Result}; pub struct ClearDocuments<'t, 'u, 'i> { wtxn: &'t mut heed::RwTxn<'i, 'u>, @@ -47,7 +47,7 @@ impl<'t, 'u, 'i> ClearDocuments<'t, 'u, 'i> { self.index.put_words_prefixes_fst(self.wtxn, &fst::Set::default())?; self.index.put_external_documents_ids(self.wtxn, &ExternalDocumentsIds::default())?; self.index.put_documents_ids(self.wtxn, &RoaringBitmap::default())?; - self.index.put_field_distribution(self.wtxn, &FieldsDistribution::default())?; + self.index.put_field_distribution(self.wtxn, &FieldDistribution::default())?; // We clean all the faceted documents ids. let empty = RoaringBitmap::default(); diff --git a/milli/src/update/index_documents/transform.rs b/milli/src/update/index_documents/transform.rs index 074d281ba..d4a730fcc 100644 --- a/milli/src/update/index_documents/transform.rs +++ b/milli/src/update/index_documents/transform.rs @@ -18,7 +18,7 @@ use crate::index::db_name; use crate::update::index_documents::merge_function::{keep_latest_obkv, merge_obkvs}; use crate::update::{AvailableDocumentsIds, UpdateIndexingStep}; use crate::{ - ExternalDocumentsIds, FieldId, FieldsDistribution, FieldsIdsMap, Index, MergeFn, Result, BEU32, + ExternalDocumentsIds, FieldId, FieldDistribution, FieldsIdsMap, Index, MergeFn, Result, BEU32, }; const DEFAULT_PRIMARY_KEY_NAME: &str = "id"; @@ -26,7 +26,7 @@ const DEFAULT_PRIMARY_KEY_NAME: &str = "id"; pub struct TransformOutput { pub primary_key: String, pub fields_ids_map: FieldsIdsMap, - pub field_distribution: FieldsDistribution, + pub field_distribution: FieldDistribution, pub external_documents_ids: ExternalDocumentsIds<'static>, pub new_documents_ids: RoaringBitmap, pub replaced_documents_ids: RoaringBitmap,