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