From e2405911286fa25b44a83b44d56567f9627097af Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 30 Jun 2020 18:44:17 +0200 Subject: [PATCH] add test document over 1000 words --- meilisearch-core/src/raw_indexer.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/meilisearch-core/src/raw_indexer.rs b/meilisearch-core/src/raw_indexer.rs index b7e7fb979..89c62a3d4 100644 --- a/meilisearch-core/src/raw_indexer.rs +++ b/meilisearch-core/src/raw_indexer.rs @@ -291,4 +291,22 @@ mod tests { } = indexer.build(); assert!(words_doc_indexes.get(&"buffering".to_owned().into_bytes()).is_some()); } + + #[test] + fn words_over_index_1000_not_indexed() { + let mut indexer = RawIndexer::new(fst::Set::default()); + let indexed_pos = IndexedPos(0); + let docid = DocumentId(0); + let mut text = String::with_capacity(5000); + for _ in 0..1000 { + text.push_str("less "); + } + text.push_str("more"); + indexer.index_text(docid, indexed_pos, &text); + let Indexed { + words_doc_indexes, .. + } = indexer.build(); + assert!(words_doc_indexes.get(&"less".to_owned().into_bytes()).is_some()); + assert!(words_doc_indexes.get(&"more".to_owned().into_bytes()).is_none()); + } }