mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
Fix pull request reviews
Update milli/src/fields_ids_map.rs Update milli/src/search/criteria/exactness.rs Update milli/src/search/criteria/mod.rs
This commit is contained in:
parent
c1ce4e4ca9
commit
44b6843de7
@ -66,12 +66,12 @@ impl FieldsIdsMap {
|
|||||||
self.ids_names.iter().map(|(id, name)| (*id, name.as_str()))
|
self.ids_names.iter().map(|(id, name)| (*id, name.as_str()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over the ids in the ids order.
|
/// Iterate over the ids in the order of the ids.
|
||||||
pub fn ids<'a>(&'a self) -> impl Iterator<Item=FieldId> + 'a {
|
pub fn ids<'a>(&'a self) -> impl Iterator<Item=FieldId> + 'a {
|
||||||
self.ids_names.keys().copied()
|
self.ids_names.keys().copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over the names in the ids order.
|
/// Iterate over the names in the order of the ids.
|
||||||
pub fn names(&self) -> impl Iterator<Item=&str> {
|
pub fn names(&self) -> impl Iterator<Item=&str> {
|
||||||
self.ids_names.values().map(AsRef::as_ref)
|
self.ids_names.values().map(AsRef::as_ref)
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ impl<'t> Criterion for Exactness<'t> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
debug!("Exactness for query {:?} at state {:?}", self.query, self.state);
|
debug!("Exactness at state {:?}", self.state);
|
||||||
|
|
||||||
match self.state.as_mut() {
|
match self.state.as_mut() {
|
||||||
Some(state) if state.is_empty() => {
|
Some(state) if state.is_empty() => {
|
||||||
@ -296,27 +296,12 @@ fn attribute_start_with_docids(ctx: &dyn Context, attribute_id: u32, query: &[Ex
|
|||||||
Ok(attribute_candidates_array)
|
Ok(attribute_candidates_array)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intersection_of(mut to_intersect: Vec<&RoaringBitmap>) -> RoaringBitmap {
|
fn intersection_of(mut rbs: Vec<&RoaringBitmap>) -> RoaringBitmap {
|
||||||
match to_intersect.len() {
|
rbs.sort_unstable_by_key(|rb| rb.len());
|
||||||
0 => RoaringBitmap::new(),
|
let mut iter = rbs.into_iter();
|
||||||
1 => to_intersect[0].clone(),
|
match iter.next() {
|
||||||
2 => to_intersect[0] & to_intersect[1],
|
Some(first) => iter.fold(first.clone(), |acc, rb| acc & rb),
|
||||||
_ => {
|
|
||||||
to_intersect.sort_unstable_by(|a, b| a.len().cmp(&b.len()).reverse());
|
|
||||||
|
|
||||||
match to_intersect.pop() {
|
|
||||||
None => RoaringBitmap::new(),
|
None => RoaringBitmap::new(),
|
||||||
Some(candidates) => {
|
|
||||||
let mut candidates = candidates.clone();
|
|
||||||
while let Some(bitmap) = to_intersect.pop() {
|
|
||||||
if candidates.is_empty() { break; }
|
|
||||||
candidates &= bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
candidates
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use roaring::RoaringBitmap;
|
|||||||
use crate::{FieldId, TreeLevel, search::{word_derivations, WordDerivationsCache}};
|
use crate::{FieldId, TreeLevel, search::{word_derivations, WordDerivationsCache}};
|
||||||
use crate::{Index, DocumentId};
|
use crate::{Index, DocumentId};
|
||||||
|
|
||||||
use super::query_tree::{Operation, PrimitiveQuery, PrimitiveQueryPart, Query, QueryKind};
|
use super::query_tree::{Operation, PrimitiveQueryPart, Query, QueryKind};
|
||||||
use self::asc_desc::AscDesc;
|
use self::asc_desc::AscDesc;
|
||||||
use self::attribute::Attribute;
|
use self::attribute::Attribute;
|
||||||
use self::exactness::Exactness;
|
use self::exactness::Exactness;
|
||||||
@ -188,7 +188,7 @@ impl<'c> Context<'c> for CriteriaBuilder<'c> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn field_id_len_docids(&self, field_id: FieldId, len: u32) -> heed::Result<Option<RoaringBitmap>> {
|
fn field_id_len_docids(&self, _field_id: FieldId, _len: u32) -> heed::Result<Option<RoaringBitmap>> {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +226,6 @@ impl<'t> CriteriaBuilder<'t> {
|
|||||||
Name::Exactness => Box::new(Exactness::new(self, criterion, &primitive_query)?),
|
Name::Exactness => Box::new(Exactness::new(self, criterion, &primitive_query)?),
|
||||||
Name::Asc(field) => Box::new(AscDesc::asc(&self.index, &self.rtxn, criterion, field)?),
|
Name::Asc(field) => Box::new(AscDesc::asc(&self.index, &self.rtxn, criterion, field)?),
|
||||||
Name::Desc(field) => Box::new(AscDesc::desc(&self.index, &self.rtxn, criterion, field)?),
|
Name::Desc(field) => Box::new(AscDesc::desc(&self.index, &self.rtxn, criterion, field)?),
|
||||||
_otherwise => criterion,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +485,7 @@ pub mod test {
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn synonyms(&self, word: &str) -> heed::Result<Option<Vec<Vec<String>>>> {
|
fn synonyms(&self, _word: &str) -> heed::Result<Option<Vec<Vec<String>>>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,11 +493,11 @@ pub mod test {
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn word_level_position_docids(&self, word: &str, level: TreeLevel, left: u32, right: u32) -> Result<Option<RoaringBitmap>, heed::Error> {
|
fn word_level_position_docids(&self, _word: &str, _level: TreeLevel, _left: u32, _right: u32) -> Result<Option<RoaringBitmap>, heed::Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn field_id_len_docids(&self, field_id: FieldId, len: u32) -> heed::Result<Option<RoaringBitmap>> {
|
fn field_id_len_docids(&self, _field_id: FieldId, _len: u32) -> heed::Result<Option<RoaringBitmap>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user