From 038c26c118ef041e5843f29b5f4862c879e39979 Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 14 Mar 2024 17:52:08 +0100 Subject: [PATCH] stop returning the degraded boolean when a search was cutoff --- meilisearch/src/search.rs | 3 +- meilisearch/tests/search/mod.rs | 95 ++++++++++++++++++--------------- 2 files changed, 53 insertions(+), 45 deletions(-) diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index f83e14187..0333eb0d5 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -324,7 +324,8 @@ pub struct SearchResult { #[serde(skip_serializing_if = "Option::is_none")] pub facet_stats: Option>, - #[serde(skip_serializing_if = "std::ops::Not::not")] + // This information is only used for analytics purposes + #[serde(skip)] pub degraded: bool, } diff --git a/meilisearch/tests/search/mod.rs b/meilisearch/tests/search/mod.rs index 8c947a329..3e5c4278a 100644 --- a/meilisearch/tests/search/mod.rs +++ b/meilisearch/tests/search/mod.rs @@ -855,54 +855,61 @@ async fn test_degraded_score_details() { }), |response, code| { meili_snap::snapshot!(code, @"200 OK"); - meili_snap::snapshot!(meili_snap::json_string!(response["hits"]), @r###" - [ - { - "doggos": [ - { - "name": "bobby" - }, - { - "name": "buddy" + meili_snap::snapshot!(meili_snap::json_string!(response), @r###" + { + "hits": [ + { + "doggos": [ + { + "name": "bobby" + }, + { + "name": "buddy" + } + ], + "cattos": "pésti", + "_rankingScoreDetails": { + "skipped": 0.0 } - ], - "cattos": "pésti", - "_rankingScoreDetails": { - "skipped": 0.0 - } - }, - { - "doggos": [ - { - "name": "gros bill" + }, + { + "doggos": [ + { + "name": "gros bill" + } + ], + "cattos": [ + "simba", + "pestiféré" + ], + "_rankingScoreDetails": { + "skipped": 0.0 } - ], - "cattos": [ - "simba", - "pestiféré" - ], - "_rankingScoreDetails": { - "skipped": 0.0 - } - }, - { - "doggos": [ - { - "name": "turbo" - }, - { - "name": "fast" + }, + { + "doggos": [ + { + "name": "turbo" + }, + { + "name": "fast" + } + ], + "cattos": [ + "moumoute", + "gomez" + ], + "_rankingScoreDetails": { + "skipped": 0.0 } - ], - "cattos": [ - "moumoute", - "gomez" - ], - "_rankingScoreDetails": { - "skipped": 0.0 } - } - ] + ], + "query": "b", + "processingTimeMs": 0, + "limit": 20, + "offset": 0, + "estimatedTotalHits": 3 + } "###); }, )