mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-10 06:58:56 +01:00
Update tests
This commit is contained in:
parent
98b77aec66
commit
c42746c4cd
@ -5804,356 +5804,15 @@ async fn federation_inconsistent_merge_order() {
|
||||
}
|
||||
"###);
|
||||
|
||||
// works again with merging and forcing an order
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {
|
||||
"facetsByIndex": {
|
||||
"movies": ["title", "color"],
|
||||
"batman": ["title"],
|
||||
"movies-2": ["title", "color"],
|
||||
},
|
||||
"mergeFacets": {
|
||||
"sortFacetValuesBy": "count"
|
||||
}
|
||||
}, "queries": [
|
||||
{"indexUid" : "movies", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
{"indexUid" : "batman", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
{"indexUid" : "movies-2", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
]}))
|
||||
.await;
|
||||
snapshot!(code, @"200 OK");
|
||||
insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###"
|
||||
{
|
||||
"hits": [
|
||||
{
|
||||
"title": "Badman",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman Returns",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman the dark knight returns: Part 1",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman the dark knight returns: Part 2",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Captain Marvel",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Captain Marvel",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Escape Room",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Escape Room",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Gläss",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Gläss",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "How to Train Your Dragon: The Hidden World",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "How to Train Your Dragon: The Hidden World",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Shazam!",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Shazam!",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"processingTimeMs": "[time]",
|
||||
"limit": 20,
|
||||
"offset": 0,
|
||||
"estimatedTotalHits": 15,
|
||||
"facetDistribution": {
|
||||
"color": {
|
||||
"red": 6,
|
||||
"blue": 6,
|
||||
"yellow": 4,
|
||||
"green": 4
|
||||
},
|
||||
"title": {
|
||||
"Shazam!": 2,
|
||||
"How to Train Your Dragon: The Hidden World": 2,
|
||||
"Gläss": 2,
|
||||
"Escape Room": 2,
|
||||
"Captain Marvel": 2,
|
||||
"Batman the dark knight returns: Part 2": 1,
|
||||
"Batman the dark knight returns: Part 1": 1,
|
||||
"Batman Returns": 1,
|
||||
"Batman": 1,
|
||||
"Badman": 1
|
||||
}
|
||||
},
|
||||
"facetStats": {}
|
||||
}
|
||||
"###);
|
||||
|
||||
// works also with the other order
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {
|
||||
"facetsByIndex": {
|
||||
"movies": ["title", "color"],
|
||||
"batman": ["title"],
|
||||
"movies-2": ["title", "color"],
|
||||
},
|
||||
"mergeFacets": {
|
||||
"sortFacetValuesBy": "alpha"
|
||||
}
|
||||
}, "queries": [
|
||||
{"indexUid" : "movies", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
{"indexUid" : "batman", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
{"indexUid" : "movies-2", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
]}))
|
||||
.await;
|
||||
snapshot!(code, @"200 OK");
|
||||
insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###"
|
||||
{
|
||||
"hits": [
|
||||
{
|
||||
"title": "Badman",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman Returns",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman the dark knight returns: Part 1",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman the dark knight returns: Part 2",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Captain Marvel",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Captain Marvel",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Escape Room",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Escape Room",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Gläss",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Gläss",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "How to Train Your Dragon: The Hidden World",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "How to Train Your Dragon: The Hidden World",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Shazam!",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Shazam!",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"processingTimeMs": "[time]",
|
||||
"limit": 20,
|
||||
"offset": 0,
|
||||
"estimatedTotalHits": 15,
|
||||
"facetDistribution": {
|
||||
"color": {
|
||||
"blue": 6,
|
||||
"green": 4,
|
||||
"red": 6,
|
||||
"yellow": 4
|
||||
},
|
||||
"title": {
|
||||
"Badman": 1,
|
||||
"Batman": 1,
|
||||
"Batman Returns": 1,
|
||||
"Batman the dark knight returns: Part 1": 1,
|
||||
"Batman the dark knight returns: Part 2": 1,
|
||||
"Captain Marvel": 2,
|
||||
"Escape Room": 2,
|
||||
"Gläss": 2,
|
||||
"How to Train Your Dragon: The Hidden World": 2,
|
||||
"Shazam!": 2
|
||||
}
|
||||
},
|
||||
"facetStats": {}
|
||||
}
|
||||
"###);
|
||||
|
||||
// can limit the number of values
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {
|
||||
"facetsByIndex": {
|
||||
"movies": ["title", "color"],
|
||||
"batman": ["title"],
|
||||
"movies-2": ["title", "color"],
|
||||
"movies-2": ["title"],
|
||||
},
|
||||
"mergeFacets": {
|
||||
"sortFacetValuesBy": "count",
|
||||
"maxValuesPerFacet": 3,
|
||||
}
|
||||
}, "queries": [
|
||||
@ -6293,172 +5952,9 @@ async fn federation_inconsistent_merge_order() {
|
||||
"estimatedTotalHits": 15,
|
||||
"facetDistribution": {
|
||||
"color": {
|
||||
"red": 6,
|
||||
"blue": 6,
|
||||
"yellow": 4
|
||||
},
|
||||
"title": {
|
||||
"Shazam!": 2,
|
||||
"How to Train Your Dragon: The Hidden World": 2,
|
||||
"Gläss": 2
|
||||
}
|
||||
},
|
||||
"facetStats": {}
|
||||
}
|
||||
"###);
|
||||
|
||||
// can limit the number of values by alpha
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {
|
||||
"facetsByIndex": {
|
||||
"movies": ["title", "color"],
|
||||
"batman": ["title"],
|
||||
"movies-2": ["title", "color"],
|
||||
},
|
||||
"mergeFacets": {
|
||||
"sortFacetValuesBy": "alpha",
|
||||
"maxValuesPerFacet": 3,
|
||||
}
|
||||
}, "queries": [
|
||||
{"indexUid" : "movies", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
{"indexUid" : "batman", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
{"indexUid" : "movies-2", "q": "", "sort": ["title:asc"], "attributesToRetrieve": ["title"] },
|
||||
]}))
|
||||
.await;
|
||||
snapshot!(code, @"200 OK");
|
||||
insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###"
|
||||
{
|
||||
"hits": [
|
||||
{
|
||||
"title": "Badman",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman Returns",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman the dark knight returns: Part 1",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Batman the dark knight returns: Part 2",
|
||||
"_federation": {
|
||||
"indexUid": "batman",
|
||||
"queriesPosition": 1,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Captain Marvel",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Captain Marvel",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Escape Room",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Escape Room",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Gläss",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Gläss",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "How to Train Your Dragon: The Hidden World",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "How to Train Your Dragon: The Hidden World",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Shazam!",
|
||||
"_federation": {
|
||||
"indexUid": "movies",
|
||||
"queriesPosition": 0,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Shazam!",
|
||||
"_federation": {
|
||||
"indexUid": "movies-2",
|
||||
"queriesPosition": 2,
|
||||
"weightedRankingScore": 1.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"processingTimeMs": "[time]",
|
||||
"limit": 20,
|
||||
"offset": 0,
|
||||
"estimatedTotalHits": 15,
|
||||
"facetDistribution": {
|
||||
"color": {
|
||||
"blue": 6,
|
||||
"green": 4,
|
||||
"red": 6
|
||||
"blue": 3,
|
||||
"green": 2,
|
||||
"red": 3
|
||||
},
|
||||
"title": {
|
||||
"Badman": 1,
|
||||
|
Loading…
Reference in New Issue
Block a user