Rename the validate function as an enriching function

This commit is contained in:
Kerollmops 2022-06-21 11:14:14 +02:00
parent 905af2a2e9
commit c8ebf0de47
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
2 changed files with 8 additions and 8 deletions

View File

@ -20,7 +20,7 @@ const DEFAULT_PRIMARY_KEY: &str = "id";
/// - all the documents id exist and are extracted, /// - all the documents id exist and are extracted,
/// - the validity of them but also, /// - the validity of them but also,
/// - the validity of the `_geo` field depending on the settings. /// - the validity of the `_geo` field depending on the settings.
pub fn validate_and_enrich_documents_batch<R: Read + Seek>( pub fn enrich_documents_batch<R: Read + Seek>(
rtxn: &heed::RoTxn, rtxn: &heed::RoTxn,
index: &Index, index: &Index,
autogenerate_docids: bool, autogenerate_docids: bool,

View File

@ -1,8 +1,8 @@
mod enrich;
mod extract; mod extract;
mod helpers; mod helpers;
mod transform; mod transform;
mod typed_chunk; mod typed_chunk;
mod validate;
use std::collections::HashSet; use std::collections::HashSet;
use std::io::{Cursor, Read, Seek}; use std::io::{Cursor, Read, Seek};
@ -19,6 +19,11 @@ use serde::{Deserialize, Serialize};
use slice_group_by::GroupBy; use slice_group_by::GroupBy;
use typed_chunk::{write_typed_chunk_into_index, TypedChunk}; 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::{ pub use self::helpers::{
as_cloneable_grenad, create_sorter, create_writer, fst_stream_into_hashset, as_cloneable_grenad, create_sorter, create_writer, fst_stream_into_hashset,
fst_stream_into_vec, merge_cbo_roaring_bitmaps, merge_roaring_bitmaps, 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}; use self::helpers::{grenad_obkv_into_chunks, GrenadParameters};
pub use self::transform::{Transform, TransformOutput}; 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::documents::{obkv_to_object, DocumentsBatchReader};
use crate::error::UserError; use crate::error::UserError;
pub use crate::update::index_documents::helpers::CursorClonableMmap; 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 // 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. // the `IndexDocument` struct as it is valid to send more documents into it.
// However, if there is an internal error we throw it away! // 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.wtxn,
self.index, self.index,
self.config.autogenerate_docids, self.config.autogenerate_docids,