test fixes
This commit is contained in:
parent
08ae68c195
commit
63da68e480
|
@ -23,12 +23,9 @@ import org.elasticsearch.action.ActionRequest;
|
|||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.IndicesRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -334,8 +331,9 @@ public class SearchRequest extends ActionRequest<SearchRequest> implements Indic
|
|||
if (in.readBoolean()) {
|
||||
scroll = readScroll(in);
|
||||
}
|
||||
|
||||
source = SearchSourceBuilder.PROTOTYPE.readFrom(in);
|
||||
if (in.readBoolean()) {
|
||||
source = SearchSourceBuilder.PROTOTYPE.readFrom(in);
|
||||
}
|
||||
|
||||
types = in.readStringArray();
|
||||
indicesOptions = IndicesOptions.readIndicesOptions(in);
|
||||
|
@ -363,7 +361,12 @@ public class SearchRequest extends ActionRequest<SearchRequest> implements Indic
|
|||
out.writeBoolean(true);
|
||||
scroll.writeTo(out);
|
||||
}
|
||||
source.writeTo(out);
|
||||
if (source == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
source.writeTo(out);
|
||||
}
|
||||
out.writeStringArray(types);
|
||||
indicesOptions.writeIndicesOptions(out);
|
||||
out.writeOptionalBoolean(requestCache);
|
||||
|
|
|
@ -432,7 +432,9 @@ public class GeoShapeQueryBuilder extends AbstractQueryBuilder<GeoShapeQueryBuil
|
|||
}
|
||||
}
|
||||
builder.relation = ShapeRelation.DISJOINT.readFrom(in);
|
||||
builder.strategy = SpatialStrategy.RECURSIVE.readFrom(in);
|
||||
if (in.readBoolean()) {
|
||||
builder.strategy = SpatialStrategy.RECURSIVE.readFrom(in);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
@ -450,7 +452,11 @@ public class GeoShapeQueryBuilder extends AbstractQueryBuilder<GeoShapeQueryBuil
|
|||
out.writeOptionalString(indexedShapePath);
|
||||
}
|
||||
relation.writeTo(out);
|
||||
strategy.writeTo(out);
|
||||
boolean hasStrategy = strategy != null;
|
||||
out.writeBoolean(hasStrategy);
|
||||
if (hasStrategy) {
|
||||
strategy.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -578,7 +578,9 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
|||
BytesReference run = (BytesReference) executable.run();
|
||||
try (XContentParser parser = XContentFactory.xContent(run).createParser(run)) {
|
||||
// NOCOMMIT this override the source entirely
|
||||
request.source(SearchSourceBuilder.PROTOTYPE.fromXContent(parser, new QueryParseContext(indexService.queryParserService().indicesQueriesRegistry())));
|
||||
QueryParseContext queryParseContext = new QueryParseContext(indexService.queryParserService().indicesQueriesRegistry());
|
||||
queryParseContext.reset(parser);
|
||||
request.source(SearchSourceBuilder.PROTOTYPE.fromXContent(parser, queryParseContext));
|
||||
}
|
||||
}
|
||||
parseSource(context, request.source());
|
||||
|
@ -776,16 +778,20 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
|||
XContentParser completeRescoreParser = null;
|
||||
try {
|
||||
XContentBuilder completeRescoreBuilder = XContentFactory.jsonBuilder();
|
||||
completeRescoreBuilder.startArray();
|
||||
completeRescoreBuilder.startObject();
|
||||
completeRescoreBuilder.startArray("rescore");
|
||||
for (BytesReference rescore : source.rescores()) {
|
||||
XContentParser parser = XContentFactory.xContent(rescore).createParser(rescore);
|
||||
parser.nextToken();
|
||||
completeRescoreBuilder.copyCurrentStructure(parser);
|
||||
}
|
||||
completeRescoreBuilder.endArray();
|
||||
completeRescoreBuilder.endObject();
|
||||
BytesReference completeRescoreBytes = completeRescoreBuilder.bytes();
|
||||
completeRescoreParser = XContentFactory.xContent(completeRescoreBytes).createParser(completeRescoreBytes);
|
||||
completeRescoreParser.nextToken();
|
||||
completeRescoreParser.nextToken();
|
||||
completeRescoreParser.nextToken();
|
||||
this.elementParsers.get("rescore").parse(completeRescoreParser, context);
|
||||
} catch (Exception e) {
|
||||
String sSource = "_na_";
|
||||
|
|
Loading…
Reference in New Issue