Adapt to changes on master

This commit is contained in:
Christoph Büscher 2016-09-12 12:05:17 +02:00
parent 2fde4b2883
commit 63822c2745
4 changed files with 14 additions and 9 deletions

View File

@ -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;

View File

@ -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());

View File

@ -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());

View File

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