fix facet count bug

This commit is contained in:
mpostma 2020-09-01 10:12:00 +02:00
parent c94daf8c3d
commit 733c02dd7c

View File

@ -100,6 +100,12 @@ where
debug!("found {} documents", docids.len()); debug!("found {} documents", docids.len());
debug!("number of postings {:?}", queries.len()); debug!("number of postings {:?}", queries.len());
if let Some(f) = facet_count_docids {
// hardcoded value, until approximation optimization
result.exhaustive_facets_count = Some(true);
result.facets = Some(facet_count(f, &docids));
}
if let Some(facets_docids) = facets_docids { if let Some(facets_docids) = facets_docids {
let intersection = sdset::duo::OpBuilder::new(docids.as_ref(), facets_docids.as_set()) let intersection = sdset::duo::OpBuilder::new(docids.as_ref(), facets_docids.as_set())
.intersection() .intersection()
@ -107,12 +113,6 @@ where
docids = Cow::Owned(intersection); docids = Cow::Owned(intersection);
} }
if let Some(f) = facet_count_docids {
// hardcoded value, until approximation optimization
result.exhaustive_facets_count = Some(true);
result.facets = Some(facet_count(f, &docids));
}
let before = Instant::now(); let before = Instant::now();
mk_arena!(arena); mk_arena!(arena);
let mut bare_matches = cleanup_bare_matches(&mut arena, &docids, queries); let mut bare_matches = cleanup_bare_matches(&mut arena, &docids, queries);
@ -243,6 +243,12 @@ where
debug!("found {} documents", docids.len()); debug!("found {} documents", docids.len());
debug!("number of postings {:?}", queries.len()); debug!("number of postings {:?}", queries.len());
if let Some(f) = facet_count_docids {
// hardcoded value, until approximation optimization
result.exhaustive_facets_count = Some(true);
result.facets = Some(facet_count(f, &docids));
}
if let Some(facets_docids) = facets_docids { if let Some(facets_docids) = facets_docids {
let intersection = OpBuilder::new(docids.as_ref(), facets_docids.as_set()) let intersection = OpBuilder::new(docids.as_ref(), facets_docids.as_set())
.intersection() .intersection()
@ -250,12 +256,6 @@ where
docids = Cow::Owned(intersection); docids = Cow::Owned(intersection);
} }
if let Some(f) = facet_count_docids {
// hardcoded value, until approximation optimization
result.exhaustive_facets_count = Some(true);
result.facets = Some(facet_count(f, &docids));
}
let before = Instant::now(); let before = Instant::now();
mk_arena!(arena); mk_arena!(arena);
let mut bare_matches = cleanup_bare_matches(&mut arena, &docids, queries); let mut bare_matches = cleanup_bare_matches(&mut arena, &docids, queries);