Make RankEvalRequestTests work with transport client
This commit is contained in:
parent
795017ddfa
commit
8856565b89
|
@ -22,8 +22,8 @@ package org.elasticsearch.index.rankeval;
|
|||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
/**
|
||||
* Action used to start precision at qa evaluations.
|
||||
/**
|
||||
* Action used to start precision at qa evaluations.
|
||||
**/
|
||||
public class RankEvalAction extends Action<RankEvalRequest, RankEvalResponse, RankEvalRequestBuilder> {
|
||||
|
||||
|
|
|
@ -51,12 +51,8 @@ public class RankEvalResponse extends ActionResponse implements ToXContent {
|
|||
public RankEvalResponse() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public RankEvalResponse(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
this.specId = in.readString();
|
||||
this.qualityLevel = in.readDouble();
|
||||
this.unknownDocs = (Map<String, Collection<RatedDocumentKey>>) in.readGenericValue();
|
||||
this.readFrom(in);
|
||||
}
|
||||
|
||||
public RankEvalResponse(String specId, double qualityLevel, Map<String, Collection<RatedDocumentKey>> unknownDocs) {
|
||||
|
@ -65,7 +61,8 @@ public class RankEvalResponse extends ActionResponse implements ToXContent {
|
|||
this.unknownDocs = unknownDocs;
|
||||
}
|
||||
|
||||
public String getSpecId() {
|
||||
|
||||
public Object getSpecId() {
|
||||
return specId;
|
||||
}
|
||||
|
||||
|
@ -79,17 +76,26 @@ public class RankEvalResponse extends ActionResponse implements ToXContent {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RankEvalResult, ID :[" + specId + "], quality: " + qualityLevel + ", unknown docs: " + unknownDocs;
|
||||
return "RankEvalResponse, ID :[" + specId + "], quality: " + qualityLevel + ", unknown docs: " + unknownDocs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeString(specId);
|
||||
out.writeDouble(qualityLevel);
|
||||
out.writeOptionalString(specId);
|
||||
out.writeOptionalDouble(qualityLevel);
|
||||
out.writeGenericValue(getUnknownDocs());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
this.specId = in.readOptionalString();
|
||||
this.qualityLevel = in.readOptionalDouble();
|
||||
this.unknownDocs = (Map<String, Collection<String>>) in.readGenericValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject("rank_eval");
|
||||
|
@ -105,5 +111,4 @@ public class RankEvalResponse extends ActionResponse implements ToXContent {
|
|||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class RankEvalSpec implements Writeable {
|
|||
for (int i = 0; i < specSize; i++) {
|
||||
specifications.add(new QuerySpec(in));
|
||||
}
|
||||
eval = in.readNamedWriteable(RankedListQualityMetric.class); // TODO add to registry
|
||||
eval = in.readNamedWriteable(RankedListQualityMetric.class);
|
||||
taskId = in.readString();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ import java.util.List;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, transportClientRatio = 0.0)
|
||||
// NORELEASE need to fix transport client use case
|
||||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE)
|
||||
public class RankEvalRequestTests extends ESIntegTestCase {
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> transportClientPlugins() {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.test;
|
||||
|
||||
import com.carrotsearch.hppc.ObjectArrayList;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
|
|
Loading…
Reference in New Issue