Use the words criterion in the search module

This commit is contained in:
Kerollmops 2021-02-18 17:22:43 +01:00
parent 1e47f9b3ff
commit e174ccbd8e
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
2 changed files with 6 additions and 5 deletions

View File

@ -70,7 +70,7 @@ impl<'t> Criterion for Words<'t> {
bucket_candidates, bucket_candidates,
})); }));
}, },
(Some(_qt), Forbidden(candidates)) => { (Some(_qt), Forbidden(_candidates)) => {
todo!() todo!()
}, },
(None, Allowed(_)) => { (None, Allowed(_)) => {

View File

@ -11,8 +11,8 @@ use once_cell::sync::Lazy;
use roaring::bitmap::RoaringBitmap; use roaring::bitmap::RoaringBitmap;
use crate::search::criteria::{Criterion, CriterionResult}; use crate::search::criteria::{Criterion, CriterionResult};
use crate::search::criteria::typo::Typo; use crate::search::criteria::{typo::Typo, words::Words};
use crate::{Index, DocumentId}; use crate::{Index, FieldId, DocumentId};
pub use self::facet::{FacetCondition, FacetDistribution, FacetNumberOperator, FacetStringOperator}; pub use self::facet::{FacetCondition, FacetDistribution, FacetNumberOperator, FacetStringOperator};
pub use self::facet::{FacetIter}; pub use self::facet::{FacetIter};
@ -71,7 +71,7 @@ impl<'a> Search<'a> {
let analyzer = Analyzer::new(AnalyzerConfig::default_with_stopwords(stop_words)); let analyzer = Analyzer::new(AnalyzerConfig::default_with_stopwords(stop_words));
let result = analyzer.analyze(query); let result = analyzer.analyze(query);
let tokens = result.tokens(); let tokens = result.tokens();
builder.optional_words(false).build(tokens) builder.build(tokens)
}, },
None => None, None => None,
}; };
@ -89,7 +89,8 @@ impl<'a> Search<'a> {
// We aretesting the typo criteria but there will be more of them soon. // We aretesting the typo criteria but there will be more of them soon.
let criteria_ctx = criteria::HeedContext::new(self.rtxn, self.index)?; let criteria_ctx = criteria::HeedContext::new(self.rtxn, self.index)?;
let mut criteria = Typo::initial(&criteria_ctx, query_tree, facet_candidates)?; let typo_criterion = Typo::initial(&criteria_ctx, query_tree, facet_candidates)?;
let mut criteria = Words::new(&criteria_ctx, Box::new(typo_criterion))?;
let mut offset = self.offset; let mut offset = self.offset;
let mut limit = self.limit; let mut limit = self.limit;