From f5388e579974073134867e79190c9b6da1e1cce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Tue, 14 Mar 2017 12:21:28 -0700 Subject: [PATCH] Adapting rank_eval integration tests --- .../test/rank_eval/10_basic.yaml | 10 ++-- .../rest-api-spec/test/rank_eval/20_dcg.yaml | 60 ++++++++++--------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/10_basic.yaml b/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/10_basic.yaml index a0170f9722a..9c683bc474c 100644 --- a/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/10_basic.yaml +++ b/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/10_basic.yaml @@ -65,20 +65,20 @@ - match: { rank_eval.details.amsterdam_query.metric_details: {"relevant_docs_retrieved": 2, "docs_retrieved": 2}} - length: { rank_eval.details.amsterdam_query.hits: 3} - - match: { rank_eval.details.amsterdam_query.hits.0.hit: {"_index" : "foo", "_type" : "bar", "_id" : "doc2", "_score" : 0.44839138}} + - match: { rank_eval.details.amsterdam_query.hits.0.hit._id: "doc2"} - match: { rank_eval.details.amsterdam_query.hits.0.rating: 1} - - match: { rank_eval.details.amsterdam_query.hits.1.hit: {"_index" : "foo", "_type" : "bar", "_id" : "doc3", "_score" : 0.44839138}} + - match: { rank_eval.details.amsterdam_query.hits.1.hit._id: "doc3"} - match: { rank_eval.details.amsterdam_query.hits.1.rating: 1} - - match: { rank_eval.details.amsterdam_query.hits.2.hit: {"_index" : "foo", "_type" : "bar", "_id" : "doc4", "_score" : 0.21492207}} + - match: { rank_eval.details.amsterdam_query.hits.2.hit._id: "doc4"} - is_false: rank_eval.details.amsterdam_query.hits.2.rating - match: { rank_eval.details.berlin_query.quality_level: 1.0} - match: { rank_eval.details.berlin_query.unknown_docs: [ {"_index": "foo", "_type": "bar", "_id": "doc4"}]} - match: { rank_eval.details.berlin_query.metric_details: {"relevant_docs_retrieved": 1, "docs_retrieved": 1}} - length: { rank_eval.details.berlin_query.hits: 2} - - match: { rank_eval.details.berlin_query.hits.0.hit: { "_index" : "foo", "_type" : "bar", "_id" : "doc1", "_score" : 0.87138504}} + - match: { rank_eval.details.berlin_query.hits.0.hit._id: "doc1" } - match: { rank_eval.details.berlin_query.hits.0.rating: 1} - - match: { rank_eval.details.berlin_query.hits.1.hit: { "_index" : "foo", "_type" : "bar", "_id" : "doc4", "_score" : 0.41767058}} + - match: { rank_eval.details.berlin_query.hits.1.hit._id: "doc4" } - is_false: rank_eval.details.berlin_query.hits.1.rating --- diff --git a/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/20_dcg.yaml b/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/20_dcg.yaml index 2f784790ad5..580f21c1441 100644 --- a/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/20_dcg.yaml +++ b/modules/rank-eval/src/test/resources/rest-api-spec/test/rank_eval/20_dcg.yaml @@ -21,19 +21,21 @@ type: bar id: doc3 body: { "bar": 3 } - + - do: index: index: foo type: bar id: doc4 body: { "bar": 4 } + - do: index: index: foo type: bar id: doc5 body: { "bar": 5 } + - do: index: index: foo @@ -95,34 +97,34 @@ # if we mix both, we should get the average - do: - rank_eval: - body: { - "requests" : [ - { - "id": "dcg_query", - "request": { "query": { "match_all" : {}}, "sort" : [ "bar" ] }, - "ratings": [ - {"_index" : "foo", "_type" : "bar", "_id" : "doc1", "rating": 3}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc2", "rating": 2}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc3", "rating": 3}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc4", "rating": 0}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc5", "rating": 1}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc6", "rating": 2}] - }, - { - "id": "dcg_query_reverse", - "request": { "query": { "match_all" : {}}, "sort" : [ {"bar" : "desc" }] }, - "ratings": [ - {"_index" : "foo", "_type" : "bar", "_id" : "doc1", "rating": 3}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc2", "rating": 2}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc3", "rating": 3}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc4", "rating": 0}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc5", "rating": 1}, - {"_index" : "foo", "_type" : "bar", "_id" : "doc6", "rating": 2}] - }, - ], - "metric" : { "dcg": { }} - } + rank_eval: + body: { + "requests" : [ + { + "id": "dcg_query", + "request": { "query": { "match_all" : {}}, "sort" : [ "bar" ] }, + "ratings": [ + {"_index" : "foo", "_type" : "bar", "_id" : "doc1", "rating": 3}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc2", "rating": 2}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc3", "rating": 3}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc4", "rating": 0}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc5", "rating": 1}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc6", "rating": 2}] + }, + { + "id": "dcg_query_reverse", + "request": { "query": { "match_all" : {}}, "sort" : [ {"bar" : "desc" }] }, + "ratings": [ + {"_index" : "foo", "_type" : "bar", "_id" : "doc1", "rating": 3}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc2", "rating": 2}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc3", "rating": 3}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc4", "rating": 0}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc5", "rating": 1}, + {"_index" : "foo", "_type" : "bar", "_id" : "doc6", "rating": 2}] + }, + ], + "metric" : { "dcg": { }} + } - match: {rank_eval.quality_level: 12.073969010408984} - match: {rank_eval.details.dcg_query.quality_level: 13.84826362927298}