mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
Simplify and speedup an intersection pass
This commit is contained in:
parent
1693d1a311
commit
ce61cb7fe6
@ -193,7 +193,7 @@ impl State {
|
||||
let mut candidates_per_attribute = Vec::with_capacity(searchable_fields_ids.len());
|
||||
// then check that there exists at least one attribute that has all of the terms
|
||||
for fid in searchable_fields_ids {
|
||||
let mut intersection = MultiOps::intersection(
|
||||
let intersection = MultiOps::intersection(
|
||||
words_positions
|
||||
.iter()
|
||||
.flat_map(|(words, ..)| words.iter())
|
||||
@ -201,12 +201,10 @@ impl State {
|
||||
.flatten()
|
||||
.map(|word| -> Result<_> {
|
||||
Ok(ctx
|
||||
.get_db_word_fid_docids(Some(universe), *word, fid)?
|
||||
.get_db_word_fid_docids(Some(&candidates), *word, fid)?
|
||||
.unwrap_or_default())
|
||||
}),
|
||||
)?;
|
||||
// TODO Why not doing this intersection in the MultiOps above?
|
||||
intersection &= &candidates;
|
||||
if !intersection.is_empty() {
|
||||
// Although not really worth it in terms of performance,
|
||||
// if would be good to put this in cache for the sake of consistency
|
||||
|
Loading…
Reference in New Issue
Block a user