add authorize typo setting

This commit is contained in:
ad hoc
2022-03-16 10:03:18 +01:00
parent d8dd357326
commit c4653347fd
4 changed files with 50 additions and 3 deletions

View File

@ -112,7 +112,11 @@ impl<'a> Search<'a> {
Some(query) => {
let mut builder = QueryTreeBuilder::new(self.rtxn, self.index);
builder.optional_words(self.optional_words);
builder.authorize_typos(self.authorize_typos);
// only authorize typos if both the index and the query allow it.
let index_authorizes_typos = self.index.authorize_typos(self.rtxn)?;
builder.authorize_typos(self.authorize_typos && index_authorizes_typos);
builder.words_limit(self.words_limit);
// We make sure that the analyzer is aware of the stop words
// this ensures that the query builder is able to properly remove them.