From c8ebf0de47e09964a9b4060b1da9982a593040e1 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 21 Jun 2022 11:14:14 +0200 Subject: [PATCH] Rename the validate function as an enriching function --- .../index_documents/{validate.rs => enrich.rs} | 2 +- milli/src/update/index_documents/mod.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) rename milli/src/update/index_documents/{validate.rs => enrich.rs} (99%) diff --git a/milli/src/update/index_documents/validate.rs b/milli/src/update/index_documents/enrich.rs similarity index 99% rename from milli/src/update/index_documents/validate.rs rename to milli/src/update/index_documents/enrich.rs index 4e52f4cb9..e3c3bd6f6 100644 --- a/milli/src/update/index_documents/validate.rs +++ b/milli/src/update/index_documents/enrich.rs @@ -20,7 +20,7 @@ const DEFAULT_PRIMARY_KEY: &str = "id"; /// - all the documents id exist and are extracted, /// - the validity of them but also, /// - the validity of the `_geo` field depending on the settings. -pub fn validate_and_enrich_documents_batch( +pub fn enrich_documents_batch( rtxn: &heed::RoTxn, index: &Index, autogenerate_docids: bool, diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index fe3bd1f8f..db1a768e6 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -1,8 +1,8 @@ +mod enrich; mod extract; mod helpers; mod transform; mod typed_chunk; -mod validate; use std::collections::HashSet; use std::io::{Cursor, Read, Seek}; @@ -19,6 +19,11 @@ use serde::{Deserialize, Serialize}; use slice_group_by::GroupBy; use typed_chunk::{write_typed_chunk_into_index, TypedChunk}; +use self::enrich::enrich_documents_batch; +pub use self::enrich::{ + extract_float_from_value, validate_document_id, validate_document_id_value, + validate_geo_from_json, +}; pub use self::helpers::{ as_cloneable_grenad, create_sorter, create_writer, fst_stream_into_hashset, fst_stream_into_vec, merge_cbo_roaring_bitmaps, merge_roaring_bitmaps, @@ -27,11 +32,6 @@ pub use self::helpers::{ }; use self::helpers::{grenad_obkv_into_chunks, GrenadParameters}; pub use self::transform::{Transform, TransformOutput}; -use self::validate::validate_and_enrich_documents_batch; -pub use self::validate::{ - extract_float_from_value, validate_document_id, validate_document_id_value, - validate_geo_from_json, -}; use crate::documents::{obkv_to_object, DocumentsBatchReader}; use crate::error::UserError; pub use crate::update::index_documents::helpers::CursorClonableMmap; @@ -141,7 +141,7 @@ where // We check for user errors in this validator and if there is one, we can return // the `IndexDocument` struct as it is valid to send more documents into it. // However, if there is an internal error we throw it away! - let enriched_documents_reader = match validate_and_enrich_documents_batch( + let enriched_documents_reader = match enrich_documents_batch( self.wtxn, self.index, self.config.autogenerate_docids,