more test fixes

This commit is contained in:
Colin Goodheart-Smithe 2015-09-23 20:52:44 +01:00
parent 04864dc7d7
commit 7a209cc600
4 changed files with 37 additions and 5 deletions

View File

@ -31,7 +31,12 @@ import org.elasticsearch.index.mapper.Uid;
import org.elasticsearch.index.mapper.internal.UidFieldMapper;
import java.io.IOException;
import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
/**
* A query that will return only documents matching specific ids (and a type).
@ -144,14 +149,14 @@ public class IdsQueryBuilder extends AbstractQueryBuilder<IdsQueryBuilder> {
@Override
protected IdsQueryBuilder doReadFrom(StreamInput in) throws IOException {
IdsQueryBuilder idsQueryBuilder = new IdsQueryBuilder(in.readStringArray());
IdsQueryBuilder idsQueryBuilder = new IdsQueryBuilder(in.readOptionalStringArray());
idsQueryBuilder.addIds(in.readStringArray());
return idsQueryBuilder;
}
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
out.writeStringArray(types);
out.writeOptionalStringArray(types);
out.writeStringArray(ids.toArray(new String[ids.size()]));
}

View File

@ -820,6 +820,7 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
for (String field : source.fieldDataFields()) {
fieldDataFieldsContext.add(new FieldDataField(field));
}
fieldDataFieldsContext.setHitExecutionNeeded(true);
}
if (source.highlighter() != null) {
XContentParser highlighterParser = null;

View File

@ -33,7 +33,7 @@ public class FetchSubPhaseContext {
/**
* Set if this phase should be executed at all.
*/
void setHitExecutionNeeded(boolean hitExecutionNeeded) {
public void setHitExecutionNeeded(boolean hitExecutionNeeded) {
this.hitExecutionNeeded = hitExecutionNeeded;
}

View File

@ -23,9 +23,15 @@ import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Weight;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.query.*;
import org.elasticsearch.index.query.AbstractQueryBuilder;
import org.elasticsearch.index.query.BaseQueryParser;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.indices.IndicesModule;
import org.elasticsearch.plugins.Plugin;
@ -64,6 +70,26 @@ public class DummyQueryParserPlugin extends Plugin {
public String getWriteableName() {
return NAME;
}
@Override
protected DummyQueryBuilder doReadFrom(StreamInput in) throws IOException {
return new DummyQueryBuilder();
}
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
// Do Nothing
}
@Override
protected int doHashCode() {
return 0;
}
@Override
protected boolean doEquals(DummyQueryBuilder other) {
return true;
}
}
public static class DummyQueryParser extends BaseQueryParser {