Skip to content

Commit

Permalink
Moving Streamable declaration of query builders up to the base interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cbuescher committed May 13, 2015
1 parent d2583cf commit 1715aac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.lucene.search.Query;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.Uid;
Expand All @@ -41,7 +40,7 @@
/**
* A query that will return only documents matching specific ids (and a type).
*/
public class IdsQueryBuilder extends BaseQueryBuilder implements Streamable, BoostableQueryBuilder<IdsQueryBuilder> {
public class IdsQueryBuilder extends BaseQueryBuilder implements BoostableQueryBuilder<IdsQueryBuilder> {

private List<String> types = new ArrayList<>();

Expand Down Expand Up @@ -154,6 +153,7 @@ protected String parserName() {
return IdsQueryParser.NAME;
}

@Override
public Query toQuery(QueryParseContext parseContext) throws IOException, QueryParsingException {
if (this.ids.isEmpty()) {
return Queries.newMatchNoDocsQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.lucene.search.Query;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentBuilder;

Expand All @@ -32,7 +31,7 @@
/**
* A query that matches on all documents.
*/
public class MatchAllQueryBuilder extends BaseQueryBuilder implements Streamable, BoostableQueryBuilder<MatchAllQueryBuilder> {
public class MatchAllQueryBuilder extends BaseQueryBuilder implements BoostableQueryBuilder<MatchAllQueryBuilder> {

private float boost = 1.0f;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.lucene.BytesRefs;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.MapperService;
Expand All @@ -36,7 +35,7 @@
/**
* A Query that matches documents containing a term.
*/
public class TermQueryBuilder extends BaseQueryBuilder implements Streamable, BoostableQueryBuilder<TermQueryBuilder> {
public class TermQueryBuilder extends BaseQueryBuilder implements BoostableQueryBuilder<TermQueryBuilder> {

private String fieldName;

Expand Down Expand Up @@ -228,6 +227,7 @@ protected String parserName() {
return TermQueryParser.NAME;
}

@Override
public void readFrom(StreamInput in) throws IOException {
fieldName = in.readString();
value = in.readGenericValue();
Expand Down

0 comments on commit 1715aac

Please sign in to comment.