mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 16:06:31 +00:00 
			
		
		
		
	Improve the NOT operator to use the universe when possible
This commit is contained in:
		| @@ -349,8 +349,6 @@ impl<'a> Filter<'a> { | |||||||
|  |  | ||||||
|         match &self.condition { |         match &self.condition { | ||||||
|             FilterCondition::Not(f) => { |             FilterCondition::Not(f) => { | ||||||
|                 // TODO improve the documents_ids to also support intersections at deserialize time. |  | ||||||
|                 let all_ids = index.documents_ids(rtxn)?; |  | ||||||
|                 let selected = Self::inner_evaluate( |                 let selected = Self::inner_evaluate( | ||||||
|                     &(f.as_ref().clone()).into(), |                     &(f.as_ref().clone()).into(), | ||||||
|                     rtxn, |                     rtxn, | ||||||
| @@ -358,8 +356,14 @@ impl<'a> Filter<'a> { | |||||||
|                     filterable_fields, |                     filterable_fields, | ||||||
|                     universe, |                     universe, | ||||||
|                 )?; |                 )?; | ||||||
|  |                 match universe { | ||||||
|  |                     Some(universe) => Ok(universe - selected), | ||||||
|  |                     None => { | ||||||
|  |                         let all_ids = index.documents_ids(rtxn)?; | ||||||
|                         Ok(all_ids - selected) |                         Ok(all_ids - selected) | ||||||
|                     } |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             FilterCondition::In { fid, els } => { |             FilterCondition::In { fid, els } => { | ||||||
|                 if crate::is_faceted(fid.value(), filterable_fields) { |                 if crate::is_faceted(fid.value(), filterable_fields) { | ||||||
|                     let field_ids_map = index.fields_ids_map(rtxn)?; |                     let field_ids_map = index.fields_ids_map(rtxn)?; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user