mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-11-04 01:46:28 +00:00 
			
		
		
		
	implement initial state for words criterion
This commit is contained in:
		@@ -60,23 +60,36 @@ impl<'t> Criterion for Words<'t> {
 | 
				
			|||||||
                    self.candidates = Candidates::default();
 | 
					                    self.candidates = Candidates::default();
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                (Some(qt), Allowed(candidates)) => {
 | 
					                (Some(qt), Allowed(candidates)) => {
 | 
				
			||||||
                    let bucket_candidates = match self.parent {
 | 
					 | 
				
			||||||
                        Some(_) => take(&mut self.bucket_candidates),
 | 
					 | 
				
			||||||
                        None => candidates.clone(),
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    let mut found_candidates = resolve_candidates(self.ctx, &qt, &mut self.candidates_cache)?;
 | 
					                    let mut found_candidates = resolve_candidates(self.ctx, &qt, &mut self.candidates_cache)?;
 | 
				
			||||||
                    found_candidates.intersect_with(&candidates);
 | 
					                    found_candidates.intersect_with(&candidates);
 | 
				
			||||||
                    candidates.difference_with(&found_candidates);
 | 
					                    candidates.difference_with(&found_candidates);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    let bucket_candidates = match self.parent {
 | 
				
			||||||
 | 
					                        Some(_) => take(&mut self.bucket_candidates),
 | 
				
			||||||
 | 
					                        None => found_candidates.clone(),
 | 
				
			||||||
 | 
					                    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    return Ok(Some(CriterionResult {
 | 
					                    return Ok(Some(CriterionResult {
 | 
				
			||||||
                        query_tree: Some(qt),
 | 
					                        query_tree: Some(qt),
 | 
				
			||||||
                        candidates: found_candidates,
 | 
					                        candidates: found_candidates,
 | 
				
			||||||
                        bucket_candidates,
 | 
					                        bucket_candidates,
 | 
				
			||||||
                    }));
 | 
					                    }));
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                (Some(_qt), Forbidden(_candidates)) => {
 | 
					                (Some(qt), Forbidden(candidates)) => {
 | 
				
			||||||
                    todo!()
 | 
					                    let mut found_candidates = resolve_candidates(self.ctx, &qt, &mut self.candidates_cache)?;
 | 
				
			||||||
 | 
					                    found_candidates.difference_with(&candidates);
 | 
				
			||||||
 | 
					                    candidates.union_with(&found_candidates);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    let bucket_candidates = match self.parent {
 | 
				
			||||||
 | 
					                        Some(_) => take(&mut self.bucket_candidates),
 | 
				
			||||||
 | 
					                        None => found_candidates.clone(),
 | 
				
			||||||
 | 
					                    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    return Ok(Some(CriterionResult {
 | 
				
			||||||
 | 
					                        query_tree: Some(qt),
 | 
				
			||||||
 | 
					                        candidates: found_candidates,
 | 
				
			||||||
 | 
					                        bucket_candidates,
 | 
				
			||||||
 | 
					                    }));
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                (None, Allowed(_)) => {
 | 
					                (None, Allowed(_)) => {
 | 
				
			||||||
                    let candidates = take(&mut self.candidates).into_inner();
 | 
					                    let candidates = take(&mut self.candidates).into_inner();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user