Remove leftover FromXContentBuilder reference
This commit is contained in:
parent
2af0218bdd
commit
9d8bb720dc
|
@ -21,14 +21,12 @@ package org.elasticsearch.index.rankeval;
|
|||
|
||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||
import org.elasticsearch.common.xcontent.FromXContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
|
@ -38,7 +36,7 @@ import java.util.Objects;
|
|||
/**
|
||||
* A document ID and its rating for the query QA use case.
|
||||
* */
|
||||
public class RatedDocument extends ToXContentToBytes implements Writeable, FromXContentBuilder<RatedDocument> {
|
||||
public class RatedDocument extends ToXContentToBytes implements Writeable {
|
||||
|
||||
public static final ParseField RATING_FIELD = new ParseField("rating");
|
||||
public static final ParseField KEY_FIELD = new ParseField("key");
|
||||
|
@ -97,17 +95,6 @@ public class RatedDocument extends ToXContentToBytes implements Writeable, FromX
|
|||
out.writeVInt(rating);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RatedDocument fromXContent(XContentParser parser, ParseFieldMatcher parseFieldMatcher) throws IOException {
|
||||
return RatedDocument.fromXContent(parser, new ParseFieldMatcherSupplier() {
|
||||
|
||||
@Override
|
||||
public ParseFieldMatcher getParseFieldMatcher() {
|
||||
return parseFieldMatcher;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static RatedDocument fromXContent(XContentParser parser, ParseFieldMatcherSupplier supplier) throws IOException {
|
||||
return PARSER.apply(parser, supplier);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class RatedDocumentTests extends ESTestCase {
|
|||
public void testXContentParsing() throws IOException {
|
||||
RatedDocument testItem = createTestItem();
|
||||
XContentParser itemParser = XContentTestHelper.roundtrip(testItem);
|
||||
RatedDocument parsedItem = testItem.fromXContent(itemParser, ParseFieldMatcher.STRICT);
|
||||
RatedDocument parsedItem = RatedDocument.fromXContent(itemParser, () -> ParseFieldMatcher.STRICT);
|
||||
assertNotSame(testItem, parsedItem);
|
||||
assertEquals(testItem, parsedItem);
|
||||
assertEquals(testItem.hashCode(), parsedItem.hashCode());
|
||||
|
|
Loading…
Reference in New Issue