mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
chore: Little clean ups of meilidb-core
This commit is contained in:
parent
4f4b630ae9
commit
e8afca614c
@ -1,5 +1,4 @@
|
||||
use std::hash::Hash;
|
||||
|
||||
use hashbrown::HashMap;
|
||||
|
||||
pub struct DistinctMap<K> {
|
||||
|
@ -162,7 +162,7 @@ impl fmt::Debug for RawDocument {
|
||||
}
|
||||
|
||||
fn raw_documents_from_matches(matches: SetBuf<(DocumentId, TmpMatch, Highlight)>) -> Vec<RawDocument> {
|
||||
let mut docs_ranges = Vec::<(DocumentId, Range, Vec<Highlight>)>::new();
|
||||
let mut docs_ranges: Vec<(_, Range, _)> = Vec::new();
|
||||
let mut matches2 = Matches::with_capacity(matches.len());
|
||||
|
||||
for group in matches.linear_group_by(|(a, _, _), (b, _, _)| a == b) {
|
||||
|
@ -229,7 +229,7 @@ impl<'c, S, FI> QueryBuilder<'c, S, FI>
|
||||
}
|
||||
|
||||
pub fn add_searchable_attribute(&mut self, attribute: u16) {
|
||||
let reorders = self.searchable_attrs.get_or_insert_with(Default::default);
|
||||
let reorders = self.searchable_attrs.get_or_insert_with(ReorderedAttrs::new);
|
||||
reorders.insert_attribute(attribute);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,10 @@ pub struct ReorderedAttrs {
|
||||
}
|
||||
|
||||
impl ReorderedAttrs {
|
||||
pub fn new() -> ReorderedAttrs {
|
||||
ReorderedAttrs { count: 0, reorders: Vec::new() }
|
||||
}
|
||||
|
||||
pub fn insert_attribute(&mut self, attribute: u16) {
|
||||
self.reorders.resize(attribute as usize + 1, None);
|
||||
self.reorders[attribute as usize] = Some(self.count as u16);
|
||||
|
Loading…
Reference in New Issue
Block a user