mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-26 16:21:07 +00:00
Introduce the Proximity criterion
This commit is contained in:
@ -11,7 +11,7 @@ use once_cell::sync::Lazy;
|
||||
use roaring::bitmap::RoaringBitmap;
|
||||
|
||||
use crate::search::criteria::{Criterion, CriterionResult};
|
||||
use crate::search::criteria::{typo::Typo, words::Words, asc_desc::AscDesc};
|
||||
use crate::search::criteria::{typo::Typo, words::Words, proximity::Proximity};
|
||||
use crate::{Index, DocumentId};
|
||||
|
||||
pub use self::facet::{FacetCondition, FacetDistribution, FacetNumberOperator, FacetStringOperator};
|
||||
@ -87,17 +87,19 @@ impl<'a> Search<'a> {
|
||||
|
||||
debug!("facet candidates: {:?} took {:.02?}", facet_candidates, before.elapsed());
|
||||
|
||||
// We aretesting the typo criteria but there will be more of them soon.
|
||||
// We are testing the typo criteria but there will be more of them soon.
|
||||
let criteria_ctx = criteria::HeedContext::new(self.rtxn, self.index)?;
|
||||
let typo_criterion = Typo::initial(&criteria_ctx, query_tree, facet_candidates)?;
|
||||
let words_criterion = Words::new(&criteria_ctx, Box::new(typo_criterion))?;
|
||||
let proximity_criterion = Proximity::new(&criteria_ctx, Box::new(words_criterion))?;
|
||||
// let proximity_criterion = Proximity::initial(&criteria_ctx, query_tree, facet_candidates)?;
|
||||
let mut criteria = proximity_criterion;
|
||||
|
||||
// We sort in descending order on a specific field *by hand*, don't do that at home.
|
||||
let attr_name = "released-timestamp";
|
||||
let fid = self.index.fields_ids_map(self.rtxn)?.id(attr_name).unwrap();
|
||||
let ftype = *self.index.faceted_fields(self.rtxn)?.get(attr_name).unwrap();
|
||||
let desc_criterion = AscDesc::desc(self.index, self.rtxn, Box::new(words_criterion), fid, ftype)?;
|
||||
let mut criteria = desc_criterion;
|
||||
// // We sort in descending order on a specific field *by hand*, don't do that at home.
|
||||
// let attr_name = "released-timestamp";
|
||||
// let fid = self.index.fields_ids_map(self.rtxn)?.id(attr_name).unwrap();
|
||||
// let ftype = *self.index.faceted_fields(self.rtxn)?.get(attr_name).unwrap();
|
||||
// let desc_criterion = AscDesc::desc(self.index, self.rtxn, Box::new(words_criterion), fid, ftype)?;
|
||||
|
||||
let mut offset = self.offset;
|
||||
let mut limit = self.limit;
|
||||
|
Reference in New Issue
Block a user