From 286dd7b2e43fdc0ba93931bdf094c1d9573b7954 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Thu, 31 Mar 2022 13:51:27 +0200 Subject: [PATCH] rename min_word_len_2_typo --- milli/src/index.rs | 10 +++++----- milli/src/search/query_tree.rs | 2 +- milli/src/update/settings.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/milli/src/index.rs b/milli/src/index.rs index 0095352e4..98f0093b8 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -910,7 +910,7 @@ impl Index { Ok(()) } - pub fn min_word_len_2_typo(&self, txn: &RoTxn) -> heed::Result { + pub fn min_word_len_2_typos(&self, txn: &RoTxn) -> heed::Result { // It is not possible to put a bool in heed with OwnedType, so we put a u8 instead. We // identify 0 as being false, and anything else as true. The absence of a value is true, // because by default, we authorize typos. @@ -920,7 +920,7 @@ impl Index { .unwrap_or(DEFAULT_MIN_WORD_LEN_2_TYPOS)) } - pub(crate) fn put_min_word_len_2_typo(&self, txn: &mut RwTxn, val: u8) -> heed::Result<()> { + pub(crate) fn put_min_word_len_2_typos(&self, txn: &mut RwTxn, val: u8) -> heed::Result<()> { // It is not possible to put a bool in heed with OwnedType, so we put a u8 instead. We // identify 0 as being false, and anything else as true. The absence of a value is true, // because by default, we authorize typos. @@ -1072,15 +1072,15 @@ pub(crate) mod tests { 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); + assert_eq!(index.min_word_len_2_typos(&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(); + index.put_min_word_len_2_typos(&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); + assert_eq!(index.min_word_len_2_typos(&txn).unwrap(), 15); } } diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index acaba680f..5d78eb674 100644 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -183,7 +183,7 @@ impl<'a> Context for QueryTreeBuilder<'a> { fn min_word_len_for_typo(&self) -> heed::Result<(u8, u8)> { let one = self.index.min_word_len_1_typo(&self.rtxn)?; - let two = self.index.min_word_len_2_typo(&self.rtxn)?; + let two = self.index.min_word_len_2_typos(&self.rtxn)?; Ok((one, two)) } } diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index 5ccaba9ba..8fd9b9a9a 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -501,11 +501,11 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> { return Err(UserError::InvalidMinTypoWordSetting(*one, *two).into()); } else { self.index.put_min_word_len_1_typo(&mut self.wtxn, *one)?; - self.index.put_min_word_len_2_typo(&mut self.wtxn, *two)?; + self.index.put_min_word_len_2_typos(&mut self.wtxn, *two)?; } } (Setting::Set(one), _) => { - let two = self.index.min_word_len_2_typo(&self.wtxn)?; + let two = self.index.min_word_len_2_typos(&self.wtxn)?; if *one > two { return Err(UserError::InvalidMinTypoWordSetting(*one, two).into()); } else { @@ -517,7 +517,7 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> { if one > *two { return Err(UserError::InvalidMinTypoWordSetting(one, *two).into()); } else { - self.index.put_min_word_len_2_typo(&mut self.wtxn, *two)?; + self.index.put_min_word_len_2_typos(&mut self.wtxn, *two)?; } } _ => (), @@ -1304,7 +1304,7 @@ mod tests { let txn = index.read_txn().unwrap(); assert_eq!(index.min_word_len_1_typo(&txn).unwrap(), 8); - assert_eq!(index.min_word_len_2_typo(&txn).unwrap(), 8); + assert_eq!(index.min_word_len_2_typos(&txn).unwrap(), 8); } #[test]