From 63822c2745182177c8f33d38e0bf175017bd25d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Mon, 12 Sep 2016 12:05:17 +0200 Subject: [PATCH] Adapt to changes on master --- .../org/elasticsearch/index/rankeval/RankEvalContext.java | 5 +++++ .../org/elasticsearch/index/rankeval/RatedRequest.java | 6 +++--- .../elasticsearch/index/rankeval/RankEvalSpecTests.java | 4 ++-- .../elasticsearch/index/rankeval/RatedRequestsTests.java | 8 ++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalContext.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalContext.java index 496dcbca02a..576fc594c9a 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalContext.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalContext.java @@ -23,6 +23,7 @@ import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.ParseFieldMatcherSupplier; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.query.QueryParseContext; +import org.elasticsearch.search.SearchExtRegistry; import org.elasticsearch.search.SearchRequestParsers; import org.elasticsearch.search.aggregations.AggregatorParsers; import org.elasticsearch.search.suggest.Suggesters; @@ -47,6 +48,10 @@ public class RankEvalContext implements ParseFieldMatcherSupplier { return searchRequestParsers.aggParsers; } + public SearchExtRegistry getSearchExtParsers() { + return searchRequestParsers.searchExtParsers; + } + @Override public ParseFieldMatcher getParseFieldMatcher() { return this.parseFieldMatcher; diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RatedRequest.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RatedRequest.java index 86861a2c95e..f40f004bad7 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RatedRequest.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RatedRequest.java @@ -155,7 +155,7 @@ public class RatedRequest extends ToXContentToBytes implements Writeable { PARSER.declareString(RatedRequest::setSpecId, ID_FIELD); PARSER.declareObject(RatedRequest::setTestRequest, (p, c) -> { try { - return SearchSourceBuilder.fromXContent(c.getParseContext(), c.getAggs(), c.getSuggesters()); + return SearchSourceBuilder.fromXContent(c.getParseContext(), c.getAggs(), c.getSuggesters(), c.getSearchExtParsers()); } catch (IOException ex) { throw new ParsingException(p.getTokenLocation(), "error parsing request", ex); } @@ -206,7 +206,7 @@ public class RatedRequest extends ToXContentToBytes implements Writeable { builder.endObject(); return builder; } - + @Override public final boolean equals(Object obj) { if (this == obj) { @@ -222,7 +222,7 @@ public class RatedRequest extends ToXContentToBytes implements Writeable { Objects.equals(types, other.types) && Objects.equals(ratedDocs, other.ratedDocs); } - + @Override public final int hashCode() { return Objects.hash(specId, testRequest, indices.hashCode(), types.hashCode(), ratedDocs.hashCode()); diff --git a/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RankEvalSpecTests.java b/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RankEvalSpecTests.java index b6a6025a0ef..b7296161b05 100644 --- a/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RankEvalSpecTests.java +++ b/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RankEvalSpecTests.java @@ -53,7 +53,7 @@ public class RankEvalSpecTests extends ESTestCase { searchModule = new SearchModule(Settings.EMPTY, false, emptyList()); IndicesQueriesRegistry queriesRegistry = searchModule.getQueryParserRegistry(); Suggesters suggesters = searchModule.getSuggesters(); - searchRequestParsers = new SearchRequestParsers(queriesRegistry, aggsParsers, suggesters); + searchRequestParsers = new SearchRequestParsers(queriesRegistry, aggsParsers, suggesters, null); } @AfterClass @@ -98,7 +98,7 @@ public class RankEvalSpecTests extends ESTestCase { RankEvalSpec parsedItem = RankEvalSpec.parse(itemParser, rankContext); // IRL these come from URL parameters - see RestRankEvalAction - parsedItem.getSpecifications().stream().forEach(e -> {e.setIndices(indices); e.setTypes(types);}); + parsedItem.getSpecifications().stream().forEach(e -> {e.setIndices(indices); e.setTypes(types);}); assertNotSame(testItem, parsedItem); assertEquals(testItem, parsedItem); assertEquals(testItem.hashCode(), parsedItem.hashCode()); diff --git a/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RatedRequestsTests.java b/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RatedRequestsTests.java index 7104b6aa4f4..d8f901cfb33 100644 --- a/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RatedRequestsTests.java +++ b/modules/rank-eval/src/test/java/org/elasticsearch/index/rankeval/RatedRequestsTests.java @@ -57,7 +57,7 @@ public class RatedRequestsTests extends ESTestCase { searchModule = new SearchModule(Settings.EMPTY, false, emptyList()); IndicesQueriesRegistry queriesRegistry = searchModule.getQueryParserRegistry(); Suggesters suggesters = searchModule.getSuggesters(); - searchRequestParsers = new SearchRequestParsers(queriesRegistry, aggsParsers, suggesters); + searchRequestParsers = new SearchRequestParsers(queriesRegistry, aggsParsers, suggesters, null); } @AfterClass @@ -78,7 +78,7 @@ public class RatedRequestsTests extends ESTestCase { for (int i = 0; i < size; i++) { ratedDocs.add(RatedDocumentTests.createTestItem()); } - + return new RatedRequest(specId, testRequest, indices, types, ratedDocs); } @@ -146,6 +146,6 @@ public class RatedRequestsTests extends ESTestCase { assertEquals("3", ratedDocs.get(2).getKey().getDocID()); assertEquals(1, ratedDocs.get(2).getRating()); } - - + + }