From b83275c9c5db8038a4bb278012e8b463a76523e2 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 11 Feb 2025 15:24:50 +0100 Subject: [PATCH] Change the `updated*` functions to `only_new` functions, hopefully better communicating what they do --- crates/milli/src/update/new/document_change.rs | 6 +++--- crates/milli/src/update/new/extract/vectors/mod.rs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/milli/src/update/new/document_change.rs b/crates/milli/src/update/new/document_change.rs index 1644b2254..a757971a0 100644 --- a/crates/milli/src/update/new/document_change.rs +++ b/crates/milli/src/update/new/document_change.rs @@ -144,7 +144,7 @@ impl<'doc> Update<'doc> { )?) } - pub fn updated(&self) -> DocumentFromVersions<'_, 'doc> { + pub fn only_changed_fields(&self) -> DocumentFromVersions<'_, 'doc> { DocumentFromVersions::new(&self.new) } @@ -182,7 +182,7 @@ impl<'doc> Update<'doc> { let mut cached_current = None; let mut updated_selected_field_count = 0; - for entry in self.updated().iter_top_level_fields() { + for entry in self.only_changed_fields().iter_top_level_fields() { let (key, updated_value) = entry?; if perm_json_p::select_field(key, fields, &[]) == perm_json_p::Selection::Skip { @@ -241,7 +241,7 @@ impl<'doc> Update<'doc> { Ok(has_deleted_fields) } - pub fn updated_vectors( + pub fn only_changed_vectors( &self, doc_alloc: &'doc Bump, embedders: &'doc EmbeddingConfigs, diff --git a/crates/milli/src/update/new/extract/vectors/mod.rs b/crates/milli/src/update/new/extract/vectors/mod.rs index 2a72a1650..b268647c2 100644 --- a/crates/milli/src/update/new/extract/vectors/mod.rs +++ b/crates/milli/src/update/new/extract/vectors/mod.rs @@ -99,7 +99,8 @@ impl<'a, 'b, 'extractor> Extractor<'extractor> for EmbeddingExtractor<'a, 'b> { context.db_fields_ids_map, &context.doc_alloc, )?; - let new_vectors = update.updated_vectors(&context.doc_alloc, self.embedders)?; + let new_vectors = + update.only_changed_vectors(&context.doc_alloc, self.embedders)?; if let Some(new_vectors) = &new_vectors { unused_vectors_distribution.append(new_vectors)?;