mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
update tests
This commit is contained in:
parent
bb5d931f16
commit
f182afc50b
@ -1059,12 +1059,12 @@ mod tests {
|
||||
let data = r#"
|
||||
{
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)"
|
||||
],
|
||||
"searchableAttributes": ["name", "release_date"],
|
||||
|
@ -57,13 +57,13 @@ pub fn enrich_server_with_movies_settings(
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let json = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"dsc(popularity)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(vote_average)",
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
|
@ -626,13 +626,13 @@ fn search_with_settings_basic() {
|
||||
|
||||
let config = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"dsc(popularity)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
@ -732,13 +732,13 @@ fn search_with_settings_stop_words() {
|
||||
|
||||
let config = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"dsc(popularity)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
@ -839,13 +839,13 @@ fn search_with_settings_synonyms() {
|
||||
|
||||
let config = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"dsc(popularity)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
@ -951,13 +951,13 @@ fn search_with_settings_ranking_rules() {
|
||||
|
||||
let config = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"asc(vote_average)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(popularity)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
@ -1058,13 +1058,13 @@ fn search_with_settings_searchable_attributes() {
|
||||
|
||||
let config = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"dsc(popularity)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
@ -1164,13 +1164,13 @@ fn search_with_settings_displayed_attributes() {
|
||||
|
||||
let config = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"dsc(popularity)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
@ -1235,13 +1235,13 @@ fn search_with_settings_searchable_attributes_2() {
|
||||
|
||||
let config = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"dsc(popularity)",
|
||||
"_exactness",
|
||||
"exactness",
|
||||
"dsc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
|
@ -41,12 +41,12 @@ fn write_all_and_delete() {
|
||||
|
||||
let json = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
"dsc(rank)",
|
||||
],
|
||||
@ -126,10 +126,33 @@ fn write_all_and_delete() {
|
||||
let res_value: Value = serde_json::from_slice(&buf).unwrap();
|
||||
|
||||
let json = json!({
|
||||
"rankingRules": null,
|
||||
"rankingRules": [
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"searchableAttributes": null,
|
||||
"displayedAttributes": null,
|
||||
"searchableAttributes": [
|
||||
"id",
|
||||
"release_date",
|
||||
"poster",
|
||||
"description",
|
||||
"title",
|
||||
"movie_id",
|
||||
"rank"
|
||||
],
|
||||
"displayedAttributes": [
|
||||
"movie_id",
|
||||
"description",
|
||||
"poster",
|
||||
"id",
|
||||
"release_date",
|
||||
"rank",
|
||||
"title"
|
||||
],
|
||||
"stopWords": null,
|
||||
"synonyms": null,
|
||||
"acceptNewFields": true,
|
||||
@ -169,12 +192,12 @@ fn write_all_and_update() {
|
||||
|
||||
let json = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
"dsc(rank)",
|
||||
],
|
||||
@ -235,12 +258,12 @@ fn write_all_and_update() {
|
||||
|
||||
let json_update = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
],
|
||||
"searchableAttributes": [
|
||||
@ -288,12 +311,12 @@ fn write_all_and_update() {
|
||||
|
||||
let res_expected = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
|
@ -39,12 +39,12 @@ fn write_all_and_delete() {
|
||||
// 2 - Send the settings
|
||||
|
||||
let json = json!([
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
"dsc(rank)",
|
||||
]);
|
||||
@ -95,7 +95,14 @@ fn write_all_and_delete() {
|
||||
block_on(res.into_body().read_to_end(&mut buf)).unwrap();
|
||||
let res_value: Value = serde_json::from_slice(&buf).unwrap();
|
||||
|
||||
let json = json!(null);
|
||||
let json = json!([
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness"
|
||||
]);
|
||||
|
||||
assert_json_eq!(json, res_value, ordered: false);
|
||||
}
|
||||
@ -130,12 +137,12 @@ fn write_all_and_update() {
|
||||
// 2 - Send the settings
|
||||
|
||||
let json = json!([
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
"dsc(rank)",
|
||||
]);
|
||||
@ -167,12 +174,12 @@ fn write_all_and_update() {
|
||||
// 4 - Update all settings
|
||||
|
||||
let json_update = json!([
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
]);
|
||||
|
||||
@ -199,12 +206,12 @@ fn write_all_and_update() {
|
||||
let res_value: Value = serde_json::from_slice(&buf).unwrap();
|
||||
|
||||
let res_expected = json!([
|
||||
"_typo",
|
||||
"_words",
|
||||
"_proximity",
|
||||
"_attribute",
|
||||
"_words_position",
|
||||
"_exactness",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"words_position",
|
||||
"exactness",
|
||||
"dsc(release_date)",
|
||||
]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user