From 961de4d34ea3821ba24df8c376b6e6cf0d5a307a Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 12 Dec 2024 14:56:59 +0100 Subject: [PATCH] Fix facet fst --- .../milli/src/update/new/facet_search_builder.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/milli/src/update/new/facet_search_builder.rs b/crates/milli/src/update/new/facet_search_builder.rs index 1993c1d00..d1ff6096d 100644 --- a/crates/milli/src/update/new/facet_search_builder.rs +++ b/crates/milli/src/update/new/facet_search_builder.rs @@ -103,6 +103,8 @@ impl<'indexer> FacetSearchBuilder<'indexer> { #[tracing::instrument(level = "trace", skip_all, target = "indexing::facet_fst")] pub fn merge_and_write(self, index: &Index, wtxn: &mut RwTxn, rtxn: &RoTxn) -> Result<()> { + tracing::trace!("merge facet strings for facet search: {:?}", self.registered_facets); + let reader = self.normalized_facet_string_docids_sorter.into_reader_cursors()?; let mut builder = grenad::MergerBuilder::new(MergeDeladdBtreesetString); builder.extend(reader); @@ -118,12 +120,15 @@ impl<'indexer> FacetSearchBuilder<'indexer> { BEU16StrCodec::bytes_decode(key).map_err(heed::Error::Encoding)?; if current_field_id != Some(field_id) { - if let Some(fst_merger_builder) = fst_merger_builder { + if let (Some(current_field_id), Some(fst_merger_builder)) = + (current_field_id, fst_merger_builder) + { let mmap = fst_merger_builder.build(&mut callback)?; - index - .facet_id_string_fst - .remap_data_type::() - .put(wtxn, &field_id, &mmap)?; + index.facet_id_string_fst.remap_data_type::().put( + wtxn, + ¤t_field_id, + &mmap, + )?; } fst = index.facet_id_string_fst.get(rtxn, &field_id)?;