From 132916f62cbba599d9ce11a678ed8c7f0435ace5 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Wed, 9 Oct 2024 11:35:45 +0200 Subject: [PATCH] Only run word pair proximity docids extraction if proximity_precision enables it --- milli/src/update/new/indexer/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/milli/src/update/new/indexer/mod.rs b/milli/src/update/new/indexer/mod.rs index 4592feb43..e49f0ab9c 100644 --- a/milli/src/update/new/indexer/mod.rs +++ b/milli/src/update/new/indexer/mod.rs @@ -26,10 +26,11 @@ use super::words_prefix_docids::{ use super::{StdResult, TopLevelMap}; use crate::documents::{PrimaryKey, DEFAULT_PRIMARY_KEY}; use crate::facet::FacetType; +use crate::proximity::ProximityPrecision; use crate::update::new::channel::ExtractorSender; use crate::update::settings::InnerIndexSettings; use crate::update::{FacetsUpdateBulk, GrenadParameters}; -use crate::{FieldsIdsMap, GlobalFieldsIdsMap, Index, Result, UserError}; +use crate::{Error, FieldsIdsMap, GlobalFieldsIdsMap, Index, Result, UserError}; mod de; pub mod document_changes; @@ -184,7 +185,11 @@ where extractor_sender.send_searchable::(fid_word_count_docids).unwrap(); } - { + // run the proximity extraction only if the precision is by word + // this works only if the settings didn't change during this transaction. + let rtxn = index.read_txn().unwrap(); + let proximity_precision = index.proximity_precision(&rtxn)?.unwrap_or_default(); + if proximity_precision == ProximityPrecision::ByWord { let span = tracing::trace_span!(target: "indexing::documents::extract", "word_pair_proximity_docids"); let _entered = span.enter(); extract_and_send_docids::<