mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +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()))
|
||||
}
|
||||
|
||||
/// 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 {
|
||||
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> {
|
||||
self.ids_names.values().map(AsRef::as_ref)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ impl<'t> Criterion for Exactness<'t> {
|
||||
}
|
||||
|
||||
loop {
|
||||
debug!("Exactness for query {:?} at state {:?}", self.query, self.state);
|
||||
debug!("Exactness at state {:?}", self.state);
|
||||
|
||||
match self.state.as_mut() {
|
||||
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)
|
||||
}
|
||||
|
||||
fn intersection_of(mut to_intersect: Vec<&RoaringBitmap>) -> RoaringBitmap {
|
||||
match to_intersect.len() {
|
||||
0 => RoaringBitmap::new(),
|
||||
1 => to_intersect[0].clone(),
|
||||
2 => to_intersect[0] & to_intersect[1],
|
||||
_ => {
|
||||
to_intersect.sort_unstable_by(|a, b| a.len().cmp(&b.len()).reverse());
|
||||
|
||||
match to_intersect.pop() {
|
||||
fn intersection_of(mut rbs: Vec<&RoaringBitmap>) -> RoaringBitmap {
|
||||
rbs.sort_unstable_by_key(|rb| rb.len());
|
||||
let mut iter = rbs.into_iter();
|
||||
match iter.next() {
|
||||
Some(first) => iter.fold(first.clone(), |acc, rb| acc & rb),
|
||||
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::{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::attribute::Attribute;
|
||||
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)
|
||||
}
|
||||
|
||||
@ -226,7 +226,6 @@ impl<'t> CriteriaBuilder<'t> {
|
||||
Name::Exactness => Box::new(Exactness::new(self, criterion, &primitive_query)?),
|
||||
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)?),
|
||||
_otherwise => criterion,
|
||||
};
|
||||
}
|
||||
|
||||
@ -486,7 +485,7 @@ pub mod test {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn synonyms(&self, word: &str) -> heed::Result<Option<Vec<Vec<String>>>> {
|
||||
fn synonyms(&self, _word: &str) -> heed::Result<Option<Vec<Vec<String>>>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
@ -494,11 +493,11 @@ pub mod test {
|
||||
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!()
|
||||
}
|
||||
|
||||
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!()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user