mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
Make the docids OR operation method conditional
This commit is contained in:
parent
ff1ec599e0
commit
daffcaf4c6
@ -442,8 +442,17 @@ pub fn traverse_query_tree<'o, 'txn>(
|
|||||||
println!("{:3$}docids retrieval ({:?}) took {:.02?}", "", results.len(), before.elapsed(), depth * 2);
|
println!("{:3$}docids retrieval ({:?}) took {:.02?}", "", results.len(), before.elapsed(), depth * 2);
|
||||||
|
|
||||||
let before = Instant::now();
|
let before = Instant::now();
|
||||||
let sets = results.iter().map(AsRef::as_ref).collect();
|
let docids = if results.len() > 10 {
|
||||||
let docids = sdset::multi::Union::new(sets).into_set_buf();
|
let cap = results.iter().map(|dis| dis.len()).sum();
|
||||||
|
let mut docids = Vec::with_capacity(cap);
|
||||||
|
for dis in results {
|
||||||
|
docids.extend_from_slice(&dis);
|
||||||
|
}
|
||||||
|
SetBuf::from_dirty(docids)
|
||||||
|
} else {
|
||||||
|
let sets = results.iter().map(AsRef::as_ref).collect();
|
||||||
|
sdset::multi::Union::new(sets).into_set_buf()
|
||||||
|
};
|
||||||
println!("{:2$}docids construction took {:.02?}", "", before.elapsed(), depth * 2);
|
println!("{:2$}docids construction took {:.02?}", "", before.elapsed(), depth * 2);
|
||||||
|
|
||||||
Cow::Owned(docids)
|
Cow::Owned(docids)
|
||||||
@ -473,8 +482,17 @@ pub fn traverse_query_tree<'o, 'txn>(
|
|||||||
println!("{:3$}docids retrieval ({:?}) took {:.02?}", "", results.len(), before.elapsed(), depth * 2);
|
println!("{:3$}docids retrieval ({:?}) took {:.02?}", "", results.len(), before.elapsed(), depth * 2);
|
||||||
|
|
||||||
let before = Instant::now();
|
let before = Instant::now();
|
||||||
let sets = results.iter().map(AsRef::as_ref).collect();
|
let docids = if results.len() > 10 {
|
||||||
let docids = sdset::multi::Union::new(sets).into_set_buf();
|
let cap = results.iter().map(|dis| dis.len()).sum();
|
||||||
|
let mut docids = Vec::with_capacity(cap);
|
||||||
|
for dis in results {
|
||||||
|
docids.extend_from_slice(&dis);
|
||||||
|
}
|
||||||
|
SetBuf::from_dirty(docids)
|
||||||
|
} else {
|
||||||
|
let sets = results.iter().map(AsRef::as_ref).collect();
|
||||||
|
sdset::multi::Union::new(sets).into_set_buf()
|
||||||
|
};
|
||||||
println!("{:2$}docids construction took {:.02?}", "", before.elapsed(), depth * 2);
|
println!("{:2$}docids construction took {:.02?}", "", before.elapsed(), depth * 2);
|
||||||
|
|
||||||
Cow::Owned(docids)
|
Cow::Owned(docids)
|
||||||
|
Loading…
Reference in New Issue
Block a user