Allow slop = -1 in span queries

Closes #3673
This commit is contained in:
iksnalybok 2013-09-20 20:59:48 +02:00 committed by Luca Cavanna
parent d662238221
commit be35b44df1
1 changed files with 3 additions and 3 deletions

View File

@ -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;
@ -79,7 +79,7 @@ public class SpanNearQueryBuilder extends BaseQueryBuilder implements SpanQueryB
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);
@ -88,7 +88,7 @@ public class SpanNearQueryBuilder extends BaseQueryBuilder implements SpanQueryB
clause.toXContent(builder, params);
}
builder.endArray();
builder.field("slop", slop);
builder.field("slop", slop.intValue());
if (inOrder != null) {
builder.field("in_order", inOrder);
}