mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
add tests for min_word_len_for_typo
This commit is contained in:
parent
9102de5500
commit
55af85db3c
4 changed files with 83 additions and 10 deletions
|
@ -937,6 +937,7 @@ pub(crate) mod tests {
|
|||
use maplit::btreemap;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::index::{DEFAULT_MIN_WORD_LEN_1_TYPO, DEFAULT_MIN_WORD_LEN_2_TYPOS};
|
||||
use crate::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig};
|
||||
use crate::Index;
|
||||
|
||||
|
@ -1064,4 +1065,22 @@ pub(crate) mod tests {
|
|||
let txn = index.read_txn().unwrap();
|
||||
assert!(!index.authorize_typos(&txn).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_min_word_len_for_typos() {
|
||||
let index = TempIndex::new();
|
||||
let mut txn = index.write_txn().unwrap();
|
||||
|
||||
assert_eq!(index.min_word_len_1_typo(&txn).unwrap(), DEFAULT_MIN_WORD_LEN_1_TYPO);
|
||||
assert_eq!(index.min_word_len_2_typo(&txn).unwrap(), DEFAULT_MIN_WORD_LEN_2_TYPOS);
|
||||
|
||||
index.put_min_word_len_1_typo(&mut txn, 3).unwrap();
|
||||
index.put_min_word_len_2_typo(&mut txn, 15).unwrap();
|
||||
|
||||
txn.commit().unwrap();
|
||||
|
||||
let txn = index.read_txn().unwrap();
|
||||
assert_eq!(index.min_word_len_1_typo(&txn).unwrap(), 3);
|
||||
assert_eq!(index.min_word_len_2_typo(&txn).unwrap(), 15);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue