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()); } - - + + }