mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-25 04:56:28 +00:00 
			
		
		
		
	ranking fields should be stored and indexed by default; fix #521
This commit is contained in:
		| @@ -427,5 +427,4 @@ fn write_setting_and_update_partial() { | ||||
|     let (response, _status_code) = server.get_all_settings(); | ||||
|  | ||||
|     assert_json_eq!(expected, response, ordered: false); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -135,3 +135,54 @@ fn send_malformed_custom_rule() { | ||||
|     let (_response, status_code) = server.update_ranking_rules_sync(body); | ||||
|     assert_eq!(status_code, 400); | ||||
| } | ||||
|  | ||||
| // Test issue https://github.com/meilisearch/MeiliSearch/issues/521 | ||||
| #[test] | ||||
| fn write_custom_ranking_and_index_documents() { | ||||
|     let mut server = common::Server::with_uid("movies"); | ||||
|     let body = json!({ | ||||
|         "uid": "movies", | ||||
|         "primaryKey": "id", | ||||
|     }); | ||||
|     server.create_index(body); | ||||
|  | ||||
|     // 1 - Add ranking rules with one custom ranking on a string | ||||
|  | ||||
|     let body = json!([ | ||||
|         "asc(title)", | ||||
|         "typo" | ||||
|     ]); | ||||
|  | ||||
|     server.update_ranking_rules(body); | ||||
|  | ||||
|     // 2 - Add documents | ||||
|  | ||||
|     let body = json!([ | ||||
|       { | ||||
|         "id": 1, | ||||
|         "title": "Le Petit Prince", | ||||
|         "author": "Exupéry" | ||||
|       }, | ||||
|       { | ||||
|         "id": 2, | ||||
|         "title": "Pride and Prejudice", | ||||
|         "author": "Jane Austen" | ||||
|       } | ||||
|     ]); | ||||
|  | ||||
|     server.add_or_replace_multiple_documents(body); | ||||
|  | ||||
|     // 3 - Get the first document and compare | ||||
|  | ||||
|     let expected = json!({ | ||||
|         "id": 1, | ||||
|         "title": "Le Petit Prince", | ||||
|         "author": "Exupéry" | ||||
|     }); | ||||
|  | ||||
|     let (response, status_code) = server.get_document(1); | ||||
|     assert_eq!(status_code, 200); | ||||
|  | ||||
|     assert_json_eq!(response, expected, ordered: false); | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user