Skip to content

Commit

Permalink
Allow slop = -1 in span queries
Browse files Browse the repository at this point in the history
Closes #3673
  • Loading branch information
iksnalybok authored and javanna committed Sep 20, 2013
1 parent d662238 commit be35b44
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -31,7 +31,7 @@ public class SpanNearQueryBuilder extends BaseQueryBuilder implements SpanQueryB

private ArrayList<SpanQueryBuilder> clauses = new ArrayList<SpanQueryBuilder>();

private int slop = -1;
private Integer slop = null;

private Boolean inOrder;

Expand Down Expand Up @@ -79,7 +79,7 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
if (clauses.isEmpty()) {
throw new QueryBuilderException("Must have at least one clause when building a spanNear query");
}
if (slop == -1) {
if (slop == null) {
throw new QueryBuilderException("Must set the slop when building a spanNear query");
}
builder.startObject(SpanNearQueryParser.NAME);
Expand All @@ -88,7 +88,7 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
clause.toXContent(builder, params);
}
builder.endArray();
builder.field("slop", slop);
builder.field("slop", slop.intValue());
if (inOrder != null) {
builder.field("in_order", inOrder);
}
Expand Down

0 comments on commit be35b44

Please sign in to comment.