mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-02 01:25:45 +01:00
Merge #743
743: Fix finite pagination with placeholder search r=Kerollmops a=ManyTheFish this bug is reproducible on real datasets and is hard to isolate in a simple test. related to: https://github.com/meilisearch/meilisearch/issues/3200 poke `@curquiza` Co-authored-by: ManyTheFish <many@meilisearch.com>
This commit is contained in:
commit
5114686394
@ -39,19 +39,24 @@ impl<D: Distinct> Criterion for Initial<'_, D> {
|
|||||||
self.answer
|
self.answer
|
||||||
.take()
|
.take()
|
||||||
.map(|mut answer| {
|
.map(|mut answer| {
|
||||||
if self.exhaustive_number_hits && answer.query_tree.is_some() {
|
if self.exhaustive_number_hits {
|
||||||
// resolve the whole query tree to retrieve an exhaustive list of documents matching the query.
|
// resolve the whole query tree to retrieve an exhaustive list of documents matching the query.
|
||||||
// then remove the potential soft deleted documents.
|
let candidates = answer
|
||||||
let mut candidates = resolve_query_tree(
|
.query_tree
|
||||||
self.ctx,
|
.as_ref()
|
||||||
answer.query_tree.as_ref().unwrap(),
|
.map(|query_tree| resolve_query_tree(self.ctx, query_tree, params.wdcache))
|
||||||
params.wdcache,
|
.transpose()?;
|
||||||
)? - params.excluded_candidates;
|
|
||||||
|
|
||||||
// Apply the filters on the documents retrieved with the query tree.
|
// then intersect the candidates with the potential filtered candidates.
|
||||||
if let Some(ref filtered_candidates) = answer.filtered_candidates {
|
let mut candidates = match (candidates, answer.filtered_candidates.take()) {
|
||||||
candidates &= filtered_candidates;
|
(Some(candidates), Some(filtered)) => candidates & filtered,
|
||||||
}
|
(Some(candidates), None) => candidates,
|
||||||
|
(None, Some(filtered)) => filtered,
|
||||||
|
(None, None) => self.ctx.documents_ids()?,
|
||||||
|
};
|
||||||
|
|
||||||
|
// then remove the potential soft deleted documents.
|
||||||
|
candidates -= params.excluded_candidates;
|
||||||
|
|
||||||
// because the initial_candidates should be an exhaustive count of the matching documents,
|
// because the initial_candidates should be an exhaustive count of the matching documents,
|
||||||
// we precompute the distinct attributes.
|
// we precompute the distinct attributes.
|
||||||
|
Loading…
Reference in New Issue
Block a user