mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-26 05:26:27 +00:00 
			
		
		
		
	Throw error when the vector search is sent with the wrong size
This commit is contained in:
		| @@ -434,7 +434,18 @@ pub fn execute_search( | |||||||
|         let mut search = Search::default(); |         let mut search = Search::default(); | ||||||
|         let docids = match ctx.index.vector_hnsw(ctx.txn)? { |         let docids = match ctx.index.vector_hnsw(ctx.txn)? { | ||||||
|             Some(hnsw) => { |             Some(hnsw) => { | ||||||
|  |                 if let Some(expected_size) = hnsw.iter().map(|(_, point)| point.len()).next() { | ||||||
|  |                     if vector.len() != expected_size { | ||||||
|  |                         return Err(UserError::InvalidVectorDimensions { | ||||||
|  |                             expected: expected_size, | ||||||
|  |                             found: vector.len(), | ||||||
|  |                         } | ||||||
|  |                         .into()); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |  | ||||||
|                 let vector = NDotProductPoint::new(vector.clone()); |                 let vector = NDotProductPoint::new(vector.clone()); | ||||||
|  |  | ||||||
|                 let neighbors = hnsw.search(&vector, &mut search); |                 let neighbors = hnsw.search(&vector, &mut search); | ||||||
|  |  | ||||||
|                 let mut docids = Vec::new(); |                 let mut docids = Vec::new(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user