stop returning the degraded boolean when a search was cutoff

This commit is contained in:
Tamo 2024-03-14 17:52:08 +01:00
parent ad9192fbbf
commit 038c26c118
2 changed files with 53 additions and 45 deletions

View File

@ -324,7 +324,8 @@ pub struct SearchResult {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub facet_stats: Option<BTreeMap<String, FacetStats>>, pub facet_stats: Option<BTreeMap<String, FacetStats>>,
#[serde(skip_serializing_if = "std::ops::Not::not")] // This information is only used for analytics purposes
#[serde(skip)]
pub degraded: bool, pub degraded: bool,
} }

View File

@ -855,54 +855,61 @@ async fn test_degraded_score_details() {
}), }),
|response, code| { |response, code| {
meili_snap::snapshot!(code, @"200 OK"); meili_snap::snapshot!(code, @"200 OK");
meili_snap::snapshot!(meili_snap::json_string!(response["hits"]), @r###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
[ {
{ "hits": [
"doggos": [ {
{ "doggos": [
"name": "bobby" {
}, "name": "bobby"
{ },
"name": "buddy" {
"name": "buddy"
}
],
"cattos": "pésti",
"_rankingScoreDetails": {
"skipped": 0.0
} }
], },
"cattos": "pésti", {
"_rankingScoreDetails": { "doggos": [
"skipped": 0.0 {
} "name": "gros bill"
}, }
{ ],
"doggos": [ "cattos": [
{ "simba",
"name": "gros bill" "pestiféré"
],
"_rankingScoreDetails": {
"skipped": 0.0
} }
], },
"cattos": [ {
"simba", "doggos": [
"pestiféré" {
], "name": "turbo"
"_rankingScoreDetails": { },
"skipped": 0.0 {
} "name": "fast"
}, }
{ ],
"doggos": [ "cattos": [
{ "moumoute",
"name": "turbo" "gomez"
}, ],
{ "_rankingScoreDetails": {
"name": "fast" "skipped": 0.0
} }
],
"cattos": [
"moumoute",
"gomez"
],
"_rankingScoreDetails": {
"skipped": 0.0
} }
} ],
] "query": "b",
"processingTimeMs": 0,
"limit": 20,
"offset": 0,
"estimatedTotalHits": 3
}
"###); "###);
}, },
) )