mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 16:06:31 +00:00 
			
		
		
		
	2006: chore(http): rename task types r=curquiza a=MarinPostma Rename - documentsAddition into documentAddition - documentsPartial into documentPartial - documentsDeletion into documentDeletion close #1999 2007: bug(lib): ignore primary if already set on document addition r=curquiza a=MarinPostma Ignore the primary key if it is already set on documents updates. Add a test for verify behaviour. close #2002 Co-authored-by: Marin Postma <postma.marin@protonmail.com>
This commit is contained in:
		| @@ -563,7 +563,7 @@ async fn add_documents_no_index_creation() { | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response["status"], "succeeded"); | ||||
|     assert_eq!(response["uid"], 0); | ||||
|     assert_eq!(response["type"], "documentsAddition"); | ||||
|     assert_eq!(response["type"], "documentAddition"); | ||||
|     assert_eq!(response["details"]["receivedDocuments"], 1); | ||||
|     assert_eq!(response["details"]["indexedDocuments"], 1); | ||||
|  | ||||
| @@ -633,7 +633,7 @@ async fn document_addition_with_primary_key() { | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response["status"], "succeeded"); | ||||
|     assert_eq!(response["uid"], 0); | ||||
|     assert_eq!(response["type"], "documentsAddition"); | ||||
|     assert_eq!(response["type"], "documentAddition"); | ||||
|     assert_eq!(response["details"]["receivedDocuments"], 1); | ||||
|     assert_eq!(response["details"]["indexedDocuments"], 1); | ||||
|  | ||||
| @@ -662,7 +662,7 @@ async fn document_update_with_primary_key() { | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response["status"], "succeeded"); | ||||
|     assert_eq!(response["uid"], 0); | ||||
|     assert_eq!(response["type"], "documentsPartial"); | ||||
|     assert_eq!(response["type"], "documentPartial"); | ||||
|     assert_eq!(response["details"]["indexedDocuments"], 1); | ||||
|     assert_eq!(response["details"]["receivedDocuments"], 1); | ||||
|  | ||||
| @@ -775,7 +775,7 @@ async fn add_larger_dataset() { | ||||
|     let (response, code) = index.get_task(update_id).await; | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response["status"], "succeeded"); | ||||
|     assert_eq!(response["type"], "documentsAddition"); | ||||
|     assert_eq!(response["type"], "documentAddition"); | ||||
|     assert_eq!(response["details"]["indexedDocuments"], 77); | ||||
|     assert_eq!(response["details"]["receivedDocuments"], 77); | ||||
|     let (response, code) = index | ||||
| @@ -797,7 +797,7 @@ async fn update_larger_dataset() { | ||||
|     index.wait_task(0).await; | ||||
|     let (response, code) = index.get_task(0).await; | ||||
|     assert_eq!(code, 200); | ||||
|     assert_eq!(response["type"], "documentsPartial"); | ||||
|     assert_eq!(response["type"], "documentPartial"); | ||||
|     assert_eq!(response["details"]["indexedDocuments"], 77); | ||||
|     let (response, code) = index | ||||
|         .get_all_documents(GetAllDocumentsOptions { | ||||
| @@ -1032,3 +1032,26 @@ async fn error_primary_key_inference() { | ||||
|  | ||||
|     assert_eq!(response["error"], expected_error); | ||||
| } | ||||
|  | ||||
| #[actix_rt::test] | ||||
| async fn add_documents_with_primary_key_twice() { | ||||
|     let server = Server::new().await; | ||||
|     let index = server.index("test"); | ||||
|  | ||||
|     let documents = json!([ | ||||
|         { | ||||
|             "title": "11", | ||||
|             "desc": "foobar" | ||||
|         } | ||||
|     ]); | ||||
|  | ||||
|     index.add_documents(documents.clone(), Some("title")).await; | ||||
|     index.wait_task(0).await; | ||||
|     let (response, _code) = index.get_task(0).await; | ||||
|     assert_eq!(response["status"], "succeeded"); | ||||
|  | ||||
|     index.add_documents(documents, Some("title")).await; | ||||
|     index.wait_task(1).await; | ||||
|     let (response, _code) = index.get_task(1).await; | ||||
|     assert_eq!(response["status"], "succeeded"); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user