update the new similar tests

This commit is contained in:
Tamo 2024-06-05 11:05:19 +02:00
parent b867829ef1
commit d92c173fdc

View File

@ -252,7 +252,7 @@ async fn ranking_score_threshold() {
index index
.similar( .similar(
json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0}), json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0, "retrieveVectors": true}),
|response, code| { |response, code| {
snapshot!(code, @"200 OK"); snapshot!(code, @"200 OK");
meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"4"); meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"4");
@ -263,11 +263,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "522681", "id": "522681",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.1, "userDefined": true,
0.6, "embedding": [
0.8 0.10000000149011612,
] 0.6000000238418579,
0.800000011920929
]
}
}, },
"_rankingScore": 0.890957772731781 "_rankingScore": 0.890957772731781
}, },
@ -276,11 +279,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "299537", "id": "299537",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.6, "userDefined": true,
0.8, "embedding": [
-0.2 0.6000000238418579,
] 0.800000011920929,
-0.20000000298023224
]
}
}, },
"_rankingScore": 0.39060014486312866 "_rankingScore": 0.39060014486312866
}, },
@ -289,11 +295,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "166428", "id": "166428",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.7, "userDefined": true,
0.7, "embedding": [
-0.4 0.699999988079071,
] 0.699999988079071,
-0.4000000059604645
]
}
}, },
"_rankingScore": 0.2819308042526245 "_rankingScore": 0.2819308042526245
}, },
@ -302,11 +311,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "287947", "id": "287947",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.8, "userDefined": true,
0.4, "embedding": [
-0.5 0.800000011920929,
] 0.4000000059604645,
-0.5
]
}
}, },
"_rankingScore": 0.1662663221359253 "_rankingScore": 0.1662663221359253
} }
@ -318,7 +330,7 @@ async fn ranking_score_threshold() {
index index
.similar( .similar(
json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.2}), json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.2, "retrieveVectors": true}),
|response, code| { |response, code| {
snapshot!(code, @"200 OK"); snapshot!(code, @"200 OK");
meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"3"); meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"3");
@ -329,11 +341,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "522681", "id": "522681",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.1, "userDefined": true,
0.6, "embedding": [
0.8 0.10000000149011612,
] 0.6000000238418579,
0.800000011920929
]
}
}, },
"_rankingScore": 0.890957772731781 "_rankingScore": 0.890957772731781
}, },
@ -342,11 +357,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "299537", "id": "299537",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.6, "userDefined": true,
0.8, "embedding": [
-0.2 0.6000000238418579,
] 0.800000011920929,
-0.20000000298023224
]
}
}, },
"_rankingScore": 0.39060014486312866 "_rankingScore": 0.39060014486312866
}, },
@ -355,11 +373,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "166428", "id": "166428",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.7, "userDefined": true,
0.7, "embedding": [
-0.4 0.699999988079071,
] 0.699999988079071,
-0.4000000059604645
]
}
}, },
"_rankingScore": 0.2819308042526245 "_rankingScore": 0.2819308042526245
} }
@ -371,7 +392,7 @@ async fn ranking_score_threshold() {
index index
.similar( .similar(
json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.3}), json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.3, "retrieveVectors": true}),
|response, code| { |response, code| {
snapshot!(code, @"200 OK"); snapshot!(code, @"200 OK");
meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"2"); meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"2");
@ -382,11 +403,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "522681", "id": "522681",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.1, "userDefined": true,
0.6, "embedding": [
0.8 0.10000000149011612,
] 0.6000000238418579,
0.800000011920929
]
}
}, },
"_rankingScore": 0.890957772731781 "_rankingScore": 0.890957772731781
}, },
@ -395,11 +419,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "299537", "id": "299537",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.6, "userDefined": true,
0.8, "embedding": [
-0.2 0.6000000238418579,
] 0.800000011920929,
-0.20000000298023224
]
}
}, },
"_rankingScore": 0.39060014486312866 "_rankingScore": 0.39060014486312866
} }
@ -411,7 +438,7 @@ async fn ranking_score_threshold() {
index index
.similar( .similar(
json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.6}), json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.6, "retrieveVectors": true}),
|response, code| { |response, code| {
snapshot!(code, @"200 OK"); snapshot!(code, @"200 OK");
meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"1"); meili_snap::snapshot!(meili_snap::json_string!(response["estimatedTotalHits"]), @"1");
@ -422,11 +449,14 @@ async fn ranking_score_threshold() {
"release_year": 2019, "release_year": 2019,
"id": "522681", "id": "522681",
"_vectors": { "_vectors": {
"manual": [ "manual": {
0.1, "userDefined": true,
0.6, "embedding": [
0.8 0.10000000149011612,
] 0.6000000238418579,
0.800000011920929
]
}
}, },
"_rankingScore": 0.890957772731781 "_rankingScore": 0.890957772731781
} }
@ -438,7 +468,7 @@ async fn ranking_score_threshold() {
index index
.similar( .similar(
json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.9}), json!({"id": 143, "showRankingScore": true, "rankingScoreThreshold": 0.9, "retrieveVectors": true}),
|response, code| { |response, code| {
snapshot!(code, @"200 OK"); snapshot!(code, @"200 OK");
snapshot!(json_string!(response["hits"]), @"[]"); snapshot!(json_string!(response["hits"]), @"[]");