mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 07:56:28 +00:00 
			
		
		
		
	Handle star in attributes_to_retrieve
This commit is contained in:
		| @@ -182,6 +182,23 @@ async fn test_get_all_documents_attributes_to_retrieve() { | ||||
|         0 | ||||
|     ); | ||||
|  | ||||
|     let (response, code) = index | ||||
|         .get_all_documents(GetAllDocumentsOptions { | ||||
|             attributes_to_retrieve: Some(vec!["wrong"]), | ||||
|             ..Default::default() | ||||
|         }) | ||||
|         .await; | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response.as_array().unwrap().len(), 20); | ||||
|     assert_eq!( | ||||
|         response.as_array().unwrap()[0] | ||||
|             .as_object() | ||||
|             .unwrap() | ||||
|             .keys() | ||||
|             .count(), | ||||
|         0 | ||||
|     ); | ||||
|  | ||||
|     let (response, code) = index | ||||
|         .get_all_documents(GetAllDocumentsOptions { | ||||
|             attributes_to_retrieve: Some(vec!["name", "tags"]), | ||||
| @@ -198,6 +215,40 @@ async fn test_get_all_documents_attributes_to_retrieve() { | ||||
|             .count(), | ||||
|         2 | ||||
|     ); | ||||
|  | ||||
|     let (response, code) = index | ||||
|         .get_all_documents(GetAllDocumentsOptions { | ||||
|             attributes_to_retrieve: Some(vec!["*"]), | ||||
|             ..Default::default() | ||||
|         }) | ||||
|         .await; | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response.as_array().unwrap().len(), 20); | ||||
|     assert_eq!( | ||||
|         response.as_array().unwrap()[0] | ||||
|             .as_object() | ||||
|             .unwrap() | ||||
|             .keys() | ||||
|             .count(), | ||||
|         16 | ||||
|     ); | ||||
|  | ||||
|     let (response, code) = index | ||||
|         .get_all_documents(GetAllDocumentsOptions { | ||||
|             attributes_to_retrieve: Some(vec!["*", "wrong"]), | ||||
|             ..Default::default() | ||||
|         }) | ||||
|         .await; | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response.as_array().unwrap().len(), 20); | ||||
|     assert_eq!( | ||||
|         response.as_array().unwrap()[0] | ||||
|             .as_object() | ||||
|             .unwrap() | ||||
|             .keys() | ||||
|             .count(), | ||||
|         16 | ||||
|     ); | ||||
| } | ||||
|  | ||||
| #[actix_rt::test] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user