mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 18:45:06 +08:00
fix tests
This commit is contained in:
parent
2904ca7f57
commit
6eb7843858
@ -1,2 +1,3 @@
|
|||||||
{"status": "processed","updateId": 0,"type": {"name":"Settings","settings":{"ranking_rules":{"Update":["Typo","Words","Proximity","Attribute","WordsPosition","Exactness"]},"distinct_attribute":"Nothing","primary_key":"Nothing","searchable_attributes":{"Update":["balance","picture","age","color","name","gender","email","phone","address","about","registered","latitude","longitude","tags"]},"displayed_attributes":{"Update":["about","address","age","balance","color","email","gender","id","isActive","latitude","longitude","name","phone","picture","registered","tags"]},"stop_words":"Nothing","synonyms":"Nothing","attributes_for_faceting":"Nothing"}}}
|
{"status":"processed","updateId":0,"type":{"name":"Settings","settings":{"ranking_rules":{"Update":["Typo","Words","Proximity","Attribute","WordsPosition","Exactness"]},"distinct_attribute":"Nothing","primary_key":"Nothing","searchable_attributes":"Nothing","displayed_attributes":"Nothing","stop_words":"Nothing","synonyms":"Nothing","attributes_for_faceting":"Nothing"}}}
|
||||||
{"status": "processed", "updateId": 1, "type": { "name": "DocumentsAddition"}}
|
{"status":"processed","updateId":1,"type":{"name":"DocumentsAddition","number":77}}
|
||||||
|
|
||||||
|
@ -88,40 +88,6 @@ impl Server {
|
|||||||
"wordsPosition",
|
"wordsPosition",
|
||||||
"exactness",
|
"exactness",
|
||||||
],
|
],
|
||||||
"searchableAttributes": [
|
|
||||||
"balance",
|
|
||||||
"picture",
|
|
||||||
"age",
|
|
||||||
"color",
|
|
||||||
"name",
|
|
||||||
"gender",
|
|
||||||
"email",
|
|
||||||
"phone",
|
|
||||||
"address",
|
|
||||||
"about",
|
|
||||||
"registered",
|
|
||||||
"latitude",
|
|
||||||
"longitude",
|
|
||||||
"tags",
|
|
||||||
],
|
|
||||||
"displayedAttributes": [
|
|
||||||
"id",
|
|
||||||
"isActive",
|
|
||||||
"balance",
|
|
||||||
"picture",
|
|
||||||
"age",
|
|
||||||
"color",
|
|
||||||
"name",
|
|
||||||
"gender",
|
|
||||||
"email",
|
|
||||||
"phone",
|
|
||||||
"address",
|
|
||||||
"about",
|
|
||||||
"registered",
|
|
||||||
"latitude",
|
|
||||||
"longitude",
|
|
||||||
"tags",
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server.update_all_settings(body).await;
|
server.update_all_settings(body).await;
|
||||||
|
@ -132,6 +132,8 @@ async fn get_dump_status_should_return_done() {
|
|||||||
|
|
||||||
let (value, status_code) = server.trigger_dump().await;
|
let (value, status_code) = server.trigger_dump().await;
|
||||||
|
|
||||||
|
println!("value: {:#?}", value);
|
||||||
|
|
||||||
assert_eq!(status_code, 202);
|
assert_eq!(status_code, 202);
|
||||||
|
|
||||||
let dump_uid = value["uid"].as_str().unwrap().to_string();
|
let dump_uid = value["uid"].as_str().unwrap().to_string();
|
||||||
@ -367,20 +369,10 @@ async fn dump_index_updates_should_be_valid() {
|
|||||||
compression::from_tar_gz(&dumps_dir.join(&format!("{}.dump", uid)), tmp_dir_path).unwrap();
|
compression::from_tar_gz(&dumps_dir.join(&format!("{}.dump", uid)), tmp_dir_path).unwrap();
|
||||||
|
|
||||||
let file = File::open(tmp_dir_path.join("test").join("updates.jsonl")).unwrap();
|
let file = File::open(tmp_dir_path.join("test").join("updates.jsonl")).unwrap();
|
||||||
let mut updates = read_all_jsonline(file);
|
let updates = read_all_jsonline(file);
|
||||||
|
|
||||||
|
eprintln!("{}\n", updates);
|
||||||
// hotfix until #943 is fixed (https://github.com/meilisearch/MeiliSearch/issues/943)
|
eprintln!("{}", expected);
|
||||||
updates.as_array_mut().unwrap()
|
|
||||||
.get_mut(0).unwrap()
|
|
||||||
.get_mut("type").unwrap()
|
|
||||||
.get_mut("settings").unwrap()
|
|
||||||
.get_mut("displayed_attributes").unwrap()
|
|
||||||
.get_mut("Update").unwrap()
|
|
||||||
.as_array_mut().unwrap().sort_by(|a, b| a.as_str().cmp(&b.as_str()));
|
|
||||||
|
|
||||||
eprintln!("{}\n", updates.to_string());
|
|
||||||
eprintln!("{}", expected.to_string());
|
|
||||||
assert_json_include!(expected: expected, actual: updates);
|
assert_json_include!(expected: expected, actual: updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,30 +779,32 @@ async fn update_existing_primary_key_is_error() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn test_facets_distribution_attribute() {
|
async fn test_field_distribution_attribute() {
|
||||||
let mut server = common::Server::test_server().await;
|
let mut server = common::Server::test_server().await;
|
||||||
|
|
||||||
let (response, _status_code) = server.get_index_stats().await;
|
let (response, _status_code) = server.get_index_stats().await;
|
||||||
|
|
||||||
let expected = json!({
|
let expected = json!({
|
||||||
"isIndexing": false,
|
"fieldsDistribution": {
|
||||||
"numberOfDocuments":77,
|
"about": 77,
|
||||||
"fieldsDistribution":{
|
"address": 77,
|
||||||
"age":77,
|
"age": 77,
|
||||||
"gender":77,
|
"balance": 77,
|
||||||
"phone":77,
|
"color": 77,
|
||||||
"name":77,
|
"email": 77,
|
||||||
"registered":77,
|
"gender": 77,
|
||||||
"latitude":77,
|
"id": 77,
|
||||||
"email":77,
|
"isActive": 77,
|
||||||
"tags":77,
|
"latitude": 77,
|
||||||
"longitude":77,
|
"longitude": 77,
|
||||||
"color":77,
|
"name": 77,
|
||||||
"address":77,
|
"phone": 77,
|
||||||
"balance":77,
|
"picture": 77,
|
||||||
"about":77,
|
"registered": 77,
|
||||||
"picture":77,
|
"tags": 77
|
||||||
},
|
},
|
||||||
|
"isIndexing": false,
|
||||||
|
"numberOfDocuments": 77
|
||||||
});
|
});
|
||||||
|
|
||||||
assert_json_eq!(expected, response, ordered: true);
|
assert_json_eq!(expected, response, ordered: true);
|
||||||
|
@ -1789,8 +1789,6 @@ async fn update_documents_with_facet_distribution() {
|
|||||||
server.create_index(body).await;
|
server.create_index(body).await;
|
||||||
let settings = json!({
|
let settings = json!({
|
||||||
"attributesForFaceting": ["genre"],
|
"attributesForFaceting": ["genre"],
|
||||||
"displayedAttributes": ["genre"],
|
|
||||||
"searchableAttributes": ["genre"]
|
|
||||||
});
|
});
|
||||||
server.update_all_settings(settings).await;
|
server.update_all_settings(settings).await;
|
||||||
let update1 = json!([
|
let update1 = json!([
|
||||||
|
Loading…
Reference in New Issue
Block a user