mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-27 07:14:26 +01:00
update tests for facets distribution case
This commit is contained in:
parent
18a50b4dac
commit
afacdbc7a0
@ -636,7 +636,7 @@ pub fn placeholder_document_sort(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// For each entry in facet_docids, calculates the number of documents in the intersection with candidate_docids.
|
/// For each entry in facet_docids, calculates the number of documents in the intersection with candidate_docids.
|
||||||
fn facet_count(
|
pub fn facet_count(
|
||||||
facet_docids: HashMap<String, HashMap<String, (&str, Cow<Set<DocumentId>>)>>,
|
facet_docids: HashMap<String, HashMap<String, (&str, Cow<Set<DocumentId>>)>>,
|
||||||
candidate_docids: &Set<DocumentId>,
|
candidate_docids: &Set<DocumentId>,
|
||||||
) -> HashMap<String, HashMap<String, usize>> {
|
) -> HashMap<String, HashMap<String, usize>> {
|
||||||
|
@ -204,7 +204,7 @@ impl<'c, 'f, 'd, 'i> QueryBuilder<'c, 'f, 'd, 'i> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn facet_count_docids<'a>(&self, reader: &'a MainReader) -> MResult<Option<HashMap<String, HashMap<String, Cow<'a, Set<DocumentId>>>>>> {
|
fn facet_count_docids<'a>(&self, reader: &'a MainReader) -> MResult<Option<HashMap<String, HashMap<String, (&'a str, Cow<'a, Set<DocumentId>>)>>>> {
|
||||||
match self.facets {
|
match self.facets {
|
||||||
Some(ref field_ids) => {
|
Some(ref field_ids) => {
|
||||||
let mut facet_count_map = HashMap::new();
|
let mut facet_count_map = HashMap::new();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"balance": "$2,668.55",
|
"balance": "$2,668.55",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 36,
|
"age": 36,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Lucas Hess",
|
"name": "Lucas Hess",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "lucashess@chorizon.com",
|
"email": "lucashess@chorizon.com",
|
||||||
@ -26,7 +26,7 @@
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -90,7 +90,7 @@
|
|||||||
"balance": "$2,575.78",
|
"balance": "$2,575.78",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 39,
|
"age": 39,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Mariana Pacheco",
|
"name": "Mariana Pacheco",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "marianapacheco@chorizon.com",
|
"email": "marianapacheco@chorizon.com",
|
||||||
@ -110,7 +110,7 @@
|
|||||||
"balance": "$3,793.09",
|
"balance": "$3,793.09",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 20,
|
"age": 20,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Warren Watson",
|
"name": "Warren Watson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "warrenwatson@chorizon.com",
|
"email": "warrenwatson@chorizon.com",
|
||||||
@ -155,7 +155,7 @@
|
|||||||
"balance": "$1,349.50",
|
"balance": "$1,349.50",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 28,
|
"age": 28,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Chrystal Boyd",
|
"name": "Chrystal Boyd",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "chrystalboyd@chorizon.com",
|
"email": "chrystalboyd@chorizon.com",
|
||||||
@ -235,7 +235,7 @@
|
|||||||
"balance": "$1,351.43",
|
"balance": "$1,351.43",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 28,
|
"age": 28,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Evans Wagner",
|
"name": "Evans Wagner",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "evanswagner@chorizon.com",
|
"email": "evanswagner@chorizon.com",
|
||||||
@ -431,7 +431,7 @@
|
|||||||
"balance": "$1,986.48",
|
"balance": "$1,986.48",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 38,
|
"age": 38,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Florence Long",
|
"name": "Florence Long",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "florencelong@chorizon.com",
|
"email": "florencelong@chorizon.com",
|
||||||
@ -530,7 +530,7 @@
|
|||||||
"balance": "$3,973.43",
|
"balance": "$3,973.43",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 29,
|
"age": 29,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Sykes Conley",
|
"name": "Sykes Conley",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "sykesconley@chorizon.com",
|
"email": "sykesconley@chorizon.com",
|
||||||
@ -813,7 +813,7 @@
|
|||||||
"balance": "$1,992.38",
|
"balance": "$1,992.38",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 40,
|
"age": 40,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Christina Short",
|
"name": "Christina Short",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "christinashort@chorizon.com",
|
"email": "christinashort@chorizon.com",
|
||||||
@ -944,7 +944,7 @@
|
|||||||
"balance": "$2,893.45",
|
"balance": "$2,893.45",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 22,
|
"age": 22,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Joni Spears",
|
"name": "Joni Spears",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "jonispears@chorizon.com",
|
"email": "jonispears@chorizon.com",
|
||||||
@ -988,7 +988,7 @@
|
|||||||
"balance": "$1,348.04",
|
"balance": "$1,348.04",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 34,
|
"age": 34,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Lawson Curtis",
|
"name": "Lawson Curtis",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "lawsoncurtis@chorizon.com",
|
"email": "lawsoncurtis@chorizon.com",
|
||||||
@ -1006,7 +1006,7 @@
|
|||||||
"balance": "$1,132.41",
|
"balance": "$1,132.41",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 38,
|
"age": 38,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Goff May",
|
"name": "Goff May",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "goffmay@chorizon.com",
|
"email": "goffmay@chorizon.com",
|
||||||
@ -1026,7 +1026,7 @@
|
|||||||
"balance": "$1,201.87",
|
"balance": "$1,201.87",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 38,
|
"age": 38,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Goodman Becker",
|
"name": "Goodman Becker",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "goodmanbecker@chorizon.com",
|
"email": "goodmanbecker@chorizon.com",
|
||||||
@ -1069,7 +1069,7 @@
|
|||||||
"balance": "$1,947.08",
|
"balance": "$1,947.08",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 21,
|
"age": 21,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Guerra Mcintyre",
|
"name": "Guerra Mcintyre",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "guerramcintyre@chorizon.com",
|
"email": "guerramcintyre@chorizon.com",
|
||||||
@ -1153,7 +1153,7 @@
|
|||||||
"balance": "$2,113.29",
|
"balance": "$2,113.29",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 28,
|
"age": 28,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Richards Walls",
|
"name": "Richards Walls",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "richardswalls@chorizon.com",
|
"email": "richardswalls@chorizon.com",
|
||||||
@ -1211,7 +1211,7 @@
|
|||||||
"balance": "$1,844.56",
|
"balance": "$1,844.56",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 20,
|
"age": 20,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Kaitlin Conner",
|
"name": "Kaitlin Conner",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "kaitlinconner@chorizon.com",
|
"email": "kaitlinconner@chorizon.com",
|
||||||
@ -1229,7 +1229,7 @@
|
|||||||
"balance": "$2,876.10",
|
"balance": "$2,876.10",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 38,
|
"age": 38,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Mamie Fischer",
|
"name": "Mamie Fischer",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "mamiefischer@chorizon.com",
|
"email": "mamiefischer@chorizon.com",
|
||||||
@ -1252,7 +1252,7 @@
|
|||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -1291,7 +1291,7 @@
|
|||||||
"balance": "$2,813.41",
|
"balance": "$2,813.41",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 37,
|
"age": 37,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Charles Castillo",
|
"name": "Charles Castillo",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "charlescastillo@chorizon.com",
|
"email": "charlescastillo@chorizon.com",
|
||||||
@ -1433,7 +1433,7 @@
|
|||||||
"balance": "$1,539.98",
|
"balance": "$1,539.98",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 24,
|
"age": 24,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Angelina Dyer",
|
"name": "Angelina Dyer",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "angelinadyer@chorizon.com",
|
"email": "angelinadyer@chorizon.com",
|
||||||
@ -1493,7 +1493,7 @@
|
|||||||
"balance": "$3,381.63",
|
"balance": "$3,381.63",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 38,
|
"age": 38,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Candace Sawyer",
|
"name": "Candace Sawyer",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "candacesawyer@chorizon.com",
|
"email": "candacesawyer@chorizon.com",
|
||||||
@ -1514,7 +1514,7 @@
|
|||||||
"balance": "$1,640.98",
|
"balance": "$1,640.98",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Hendricks Martinez",
|
"name": "Hendricks Martinez",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "hendricksmartinez@chorizon.com",
|
"email": "hendricksmartinez@chorizon.com",
|
||||||
@ -1557,7 +1557,7 @@
|
|||||||
"balance": "$1,180.90",
|
"balance": "$1,180.90",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 36,
|
"age": 36,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Stark Wong",
|
"name": "Stark Wong",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "starkwong@chorizon.com",
|
"email": "starkwong@chorizon.com",
|
||||||
@ -1577,7 +1577,7 @@
|
|||||||
"balance": "$1,913.42",
|
"balance": "$1,913.42",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 24,
|
"age": 24,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Emma Jacobs",
|
"name": "Emma Jacobs",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "emmajacobs@chorizon.com",
|
"email": "emmajacobs@chorizon.com",
|
||||||
@ -1595,7 +1595,7 @@
|
|||||||
"balance": "$1,274.29",
|
"balance": "$1,274.29",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 25,
|
"age": 25,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Clarice Gardner",
|
"name": "Clarice Gardner",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "claricegardner@chorizon.com",
|
"email": "claricegardner@chorizon.com",
|
||||||
|
@ -156,7 +156,7 @@ async fn placeholder_search_with_filter() {
|
|||||||
|
|
||||||
test_post_get_search!(server, query, |response, _status_code| {
|
test_post_get_search!(server, query, |response, _status_code| {
|
||||||
let hits = response["hits"].as_array().unwrap();
|
let hits = response["hits"].as_array().unwrap();
|
||||||
assert!(hits.iter().all(|v| v["color"].as_str().unwrap() == "green"));
|
assert!(hits.iter().all(|v| v["color"].as_str().unwrap() == "Green"));
|
||||||
});
|
});
|
||||||
|
|
||||||
let query = json!({
|
let query = json!({
|
||||||
@ -177,7 +177,7 @@ async fn placeholder_search_with_filter() {
|
|||||||
let bug = Value::String(String::from("bug"));
|
let bug = Value::String(String::from("bug"));
|
||||||
let wontfix = Value::String(String::from("wontfix"));
|
let wontfix = Value::String(String::from("wontfix"));
|
||||||
assert!(hits.iter().all(|v|
|
assert!(hits.iter().all(|v|
|
||||||
v["color"].as_str().unwrap() == "green" &&
|
v["color"].as_str().unwrap() == "Green" &&
|
||||||
v["tags"].as_array().unwrap().contains(&bug) ||
|
v["tags"].as_array().unwrap().contains(&bug) ||
|
||||||
v["tags"].as_array().unwrap().contains(&wontfix)));
|
v["tags"].as_array().unwrap().contains(&wontfix)));
|
||||||
});
|
});
|
||||||
@ -206,7 +206,7 @@ async fn placeholder_test_faceted_search_valid() {
|
|||||||
.as_array()
|
.as_array()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.iter()
|
.iter()
|
||||||
.all(|value| value.get("color").unwrap() == "green"));
|
.all(|value| value.get("color").unwrap() == "Green"));
|
||||||
});
|
});
|
||||||
|
|
||||||
let query = json!({
|
let query = json!({
|
||||||
@ -296,7 +296,7 @@ async fn placeholder_test_faceted_search_valid() {
|
|||||||
.unwrap() == "blue"
|
.unwrap() == "blue"
|
||||||
|| value
|
|| value
|
||||||
.get("color")
|
.get("color")
|
||||||
.unwrap() == "green"));
|
.unwrap() == "Green"));
|
||||||
});
|
});
|
||||||
// test and-or: ["tags:bug", ["color:blue", "color:green"]]
|
// test and-or: ["tags:bug", ["color:blue", "color:green"]]
|
||||||
let query = json!({
|
let query = json!({
|
||||||
@ -322,7 +322,7 @@ async fn placeholder_test_faceted_search_valid() {
|
|||||||
.unwrap() == "blue"
|
.unwrap() == "blue"
|
||||||
|| value
|
|| value
|
||||||
.get("color")
|
.get("color")
|
||||||
.unwrap() == "green")));
|
.unwrap() == "Green")));
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ async fn search_with_limit() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -42,7 +42,7 @@ async fn search_with_limit() {
|
|||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -101,7 +101,7 @@ async fn search_with_offset() {
|
|||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -142,7 +142,7 @@ async fn search_with_offset() {
|
|||||||
"balance": "$2,668.55",
|
"balance": "$2,668.55",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 36,
|
"age": 36,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Lucas Hess",
|
"name": "Lucas Hess",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "lucashess@chorizon.com",
|
"email": "lucashess@chorizon.com",
|
||||||
@ -181,7 +181,7 @@ async fn search_with_attribute_to_highlight_wildcard() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -201,7 +201,7 @@ async fn search_with_attribute_to_highlight_wildcard() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "<em>Cherry</em> Orr",
|
"name": "<em>Cherry</em> Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "<em>cherry</em>orr@chorizon.com",
|
"email": "<em>cherry</em>orr@chorizon.com",
|
||||||
@ -241,7 +241,7 @@ async fn search_with_attribute_to_highlight_1() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -261,7 +261,7 @@ async fn search_with_attribute_to_highlight_1() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "<em>Cherry</em> Orr",
|
"name": "<em>Cherry</em> Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -301,7 +301,7 @@ async fn search_with_matches() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -355,7 +355,7 @@ async fn search_with_crop() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -375,7 +375,7 @@ async fn search_with_crop() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -413,7 +413,7 @@ async fn search_with_attributes_to_retrieve() {
|
|||||||
{
|
{
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"gender": "female"
|
"gender": "female"
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
@ -440,7 +440,7 @@ async fn search_with_attributes_to_retrieve_wildcard() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -478,7 +478,7 @@ async fn search_with_filter() {
|
|||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -499,7 +499,7 @@ async fn search_with_filter() {
|
|||||||
"balance": "$2,668.55",
|
"balance": "$2,668.55",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 36,
|
"age": 36,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Lucas Hess",
|
"name": "Lucas Hess",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "lucashess@chorizon.com",
|
"email": "lucashess@chorizon.com",
|
||||||
@ -547,7 +547,7 @@ async fn search_with_filter() {
|
|||||||
"balance": "$2,668.55",
|
"balance": "$2,668.55",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 36,
|
"age": 36,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Lucas Hess",
|
"name": "Lucas Hess",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "lucashess@chorizon.com",
|
"email": "lucashess@chorizon.com",
|
||||||
@ -601,7 +601,7 @@ async fn search_with_filter() {
|
|||||||
"balance": "$1,913.42",
|
"balance": "$1,913.42",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 24,
|
"age": 24,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Emma Jacobs",
|
"name": "Emma Jacobs",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "emmajacobs@chorizon.com",
|
"email": "emmajacobs@chorizon.com",
|
||||||
@ -705,7 +705,7 @@ async fn search_with_filter() {
|
|||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -726,7 +726,7 @@ async fn search_with_filter() {
|
|||||||
"balance": "$2,668.55",
|
"balance": "$2,668.55",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 36,
|
"age": 36,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Lucas Hess",
|
"name": "Lucas Hess",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "lucashess@chorizon.com",
|
"email": "lucashess@chorizon.com",
|
||||||
@ -779,7 +779,7 @@ async fn search_with_filter() {
|
|||||||
"balance": "$1,351.43",
|
"balance": "$1,351.43",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 28,
|
"age": 28,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Evans Wagner",
|
"name": "Evans Wagner",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "evanswagner@chorizon.com",
|
"email": "evanswagner@chorizon.com",
|
||||||
@ -823,7 +823,7 @@ async fn search_with_attributes_to_highlight_and_matches() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -843,7 +843,7 @@ async fn search_with_attributes_to_highlight_and_matches() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "<em>Cherry</em> Orr",
|
"name": "<em>Cherry</em> Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "<em>cherry</em>orr@chorizon.com",
|
"email": "<em>cherry</em>orr@chorizon.com",
|
||||||
@ -900,7 +900,7 @@ async fn search_with_attributes_to_highlight_and_matches_and_crop() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -920,7 +920,7 @@ async fn search_with_attributes_to_highlight_and_matches_and_crop() {
|
|||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"picture": "http://placehold.it/32x32",
|
"picture": "http://placehold.it/32x32",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -1223,7 +1223,7 @@ async fn test_faceted_search_valid() {
|
|||||||
.as_array()
|
.as_array()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.iter()
|
.iter()
|
||||||
.all(|value| value.get("color").unwrap() == "green"));
|
.all(|value| value.get("color").unwrap() == "Green"));
|
||||||
});
|
});
|
||||||
|
|
||||||
let query = json!({
|
let query = json!({
|
||||||
@ -1318,7 +1318,7 @@ async fn test_faceted_search_valid() {
|
|||||||
.unwrap() == "blue"
|
.unwrap() == "blue"
|
||||||
|| value
|
|| value
|
||||||
.get("color")
|
.get("color")
|
||||||
.unwrap() == "green"));
|
.unwrap() == "Green"));
|
||||||
});
|
});
|
||||||
// test and-or: ["tags:bug", ["color:blue", "color:green"]]
|
// test and-or: ["tags:bug", ["color:blue", "color:green"]]
|
||||||
let query = json!({
|
let query = json!({
|
||||||
@ -1345,7 +1345,7 @@ async fn test_faceted_search_valid() {
|
|||||||
.unwrap() == "blue"
|
.unwrap() == "blue"
|
||||||
|| value
|
|| value
|
||||||
.get("color")
|
.get("color")
|
||||||
.unwrap() == "green")));
|
.unwrap() == "Green")));
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1469,6 +1469,14 @@ async fn test_facet_count() {
|
|||||||
println!("{}", response);
|
println!("{}", response);
|
||||||
assert!(response.get("exhaustiveFacetsCount").is_some());
|
assert!(response.get("exhaustiveFacetsCount").is_some());
|
||||||
assert_eq!(response.get("facetsDistribution").unwrap().as_object().unwrap().values().count(), 1);
|
assert_eq!(response.get("facetsDistribution").unwrap().as_object().unwrap().values().count(), 1);
|
||||||
|
// assert that case is preserved
|
||||||
|
assert!(response["facetsDistribution"]
|
||||||
|
.as_object()
|
||||||
|
.unwrap()["color"]
|
||||||
|
.as_object()
|
||||||
|
.unwrap()
|
||||||
|
.get("Green")
|
||||||
|
.is_some());
|
||||||
});
|
});
|
||||||
// searching on color and tags
|
// searching on color and tags
|
||||||
let query = json!({
|
let query = json!({
|
||||||
|
@ -130,7 +130,7 @@ async fn search_with_settings_stop_words() {
|
|||||||
{
|
{
|
||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -140,7 +140,7 @@ async fn search_with_settings_stop_words() {
|
|||||||
{
|
{
|
||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -213,7 +213,7 @@ async fn search_with_settings_synonyms() {
|
|||||||
{
|
{
|
||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -223,7 +223,7 @@ async fn search_with_settings_synonyms() {
|
|||||||
{
|
{
|
||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -292,7 +292,7 @@ async fn search_with_settings_ranking_rules() {
|
|||||||
{
|
{
|
||||||
"balance": "$1,921.58",
|
"balance": "$1,921.58",
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -302,7 +302,7 @@ async fn search_with_settings_ranking_rules() {
|
|||||||
{
|
{
|
||||||
"balance": "$1,706.13",
|
"balance": "$1,706.13",
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
@ -438,7 +438,7 @@ async fn search_with_settings_displayed_attributes() {
|
|||||||
let expect = json!([
|
let expect = json!([
|
||||||
{
|
{
|
||||||
"age": 31,
|
"age": 31,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Harper Carson",
|
"name": "Harper Carson",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"email": "harpercarson@chorizon.com",
|
"email": "harpercarson@chorizon.com",
|
||||||
@ -446,7 +446,7 @@ async fn search_with_settings_displayed_attributes() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"age": 27,
|
"age": 27,
|
||||||
"color": "green",
|
"color": "Green",
|
||||||
"name": "Cherry Orr",
|
"name": "Cherry Orr",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"email": "cherryorr@chorizon.com",
|
"email": "cherryorr@chorizon.com",
|
||||||
|
Loading…
Reference in New Issue
Block a user