From 91c58cfa382640c0098e20497665dd6b28b2f622 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 14 Nov 2024 11:40:12 +0100 Subject: [PATCH] Fix positional databases --- .../new/extract/searchable/tokenize_document.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/milli/src/update/new/extract/searchable/tokenize_document.rs b/crates/milli/src/update/new/extract/searchable/tokenize_document.rs index 793e3a249..e6c8776c6 100644 --- a/crates/milli/src/update/new/extract/searchable/tokenize_document.rs +++ b/crates/milli/src/update/new/extract/searchable/tokenize_document.rs @@ -3,7 +3,6 @@ use std::collections::HashMap; use charabia::{SeparatorKind, Token, TokenKind, Tokenizer, TokenizerBuilder}; use serde_json::Value; -use crate::proximity::MAX_DISTANCE; use crate::update::new::document::Document; use crate::update::new::extract::perm_json_p::{ seek_leaf_values_in_array, seek_leaf_values_in_object, select_field, @@ -13,6 +12,9 @@ use crate::{ MAX_WORD_LENGTH, }; +// todo: should be crate::proximity::MAX_DISTANCE but it has been forgotten +const MAX_DISTANCE: u32 = 8; + pub struct DocumentTokenizer<'a> { pub tokenizer: &'a Tokenizer<'a>, pub attribute_to_extract: Option<&'a [&'a str]>, @@ -251,22 +253,22 @@ mod test { ]: "doggo", [ 2, - MAX_DISTANCE, + 8, ]: "doggo", [ 2, 16, ]: "catto", [ - 3, + 5, 0, ]: "10", [ - 4, + 6, 0, ]: "pesti", [ - 5, + 7, 0, ]: "23", }