implement a first version of the stop_words

The front must provide a BTreeSet containing the stop words
The stop_words are set at None if an empty Set is provided
add the stop-words in the http-ui interface

Use maplit in the test
and remove all the useless drop(rtxn) at the end of all tests
This commit is contained in:
tamo
2021-03-29 19:15:47 +02:00
parent 62a8f1d707
commit a2f46029c7
7 changed files with 203 additions and 56 deletions

View File

@ -4,7 +4,7 @@ use std::fmt;
use std::str::Utf8Error;
use std::time::Instant;
use fst::{IntoStreamer, Streamer, Set};
use fst::{IntoStreamer, Streamer};
use levenshtein_automata::{DFA, LevenshteinAutomatonBuilder as LevBuilder};
use log::debug;
use meilisearch_tokenizer::{AnalyzerConfig, Analyzer};
@ -91,8 +91,7 @@ impl<'a> Search<'a> {
let mut builder = QueryTreeBuilder::new(self.rtxn, self.index);
builder.optional_words(self.optional_words);
builder.authorize_typos(self.authorize_typos);
let stop_words = &Set::default();
let analyzer = Analyzer::new(AnalyzerConfig::default_with_stopwords(stop_words));
let analyzer = Analyzer::<Vec<u8>>::new(AnalyzerConfig::default());
let result = analyzer.analyze(query);
let tokens = result.tokens();
builder.build(tokens)?