From 5d53b11a2c3f264c3febe01fb6f7128992052d0a Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Thu, 4 Apr 2024 21:45:19 +0800 Subject: [PATCH] change debug_assert to assert in term length change `debug_assert` to `assert` since the bug with the truncated Terms only occurs in prod --- src/postings/postings_writer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/postings/postings_writer.rs b/src/postings/postings_writer.rs index 264392889..29d220565 100644 --- a/src/postings/postings_writer.rs +++ b/src/postings/postings_writer.rs @@ -204,7 +204,11 @@ impl SpecializedPostingsWriter { impl PostingsWriter for SpecializedPostingsWriter { #[inline] fn subscribe(&mut self, doc: DocId, position: u32, term: &Term, ctx: &mut IndexingContext) { - debug_assert!(term.serialized_term().len() >= 4); + assert!( + term.serialized_term().len() >= 4, + "Term too short expect >=4 but got {:?}", + term.serialized_term() + ); self.total_num_tokens += 1; let (term_index, arena) = (&mut ctx.term_index, &mut ctx.arena); term_index.mutate_or_create(term.serialized_term(), |opt_recorder: Option| {