Java API: BoostingQueryBuilder does not build the query correctly, closes #1141.
This commit is contained in:
parent
ed6a6e31d3
commit
91e050f885
|
@ -31,6 +31,17 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public abstract class BaseQueryBuilder implements QueryBuilder {
|
public abstract class BaseQueryBuilder implements QueryBuilder {
|
||||||
|
|
||||||
|
@Override public String toString() {
|
||||||
|
try {
|
||||||
|
XContentBuilder builder = XContentFactory.safeJsonBuilder();
|
||||||
|
builder.prettyPrint();
|
||||||
|
toXContent(builder, EMPTY_PARAMS);
|
||||||
|
return builder.string();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new QueryBuilderException("Failed to build query", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override public BytesStream buildAsUnsafeBytes() throws QueryBuilderException {
|
@Override public BytesStream buildAsUnsafeBytes() throws QueryBuilderException {
|
||||||
return buildAsUnsafeBytes(XContentType.JSON);
|
return buildAsUnsafeBytes(XContentType.JSON);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,5 +90,6 @@ public class BoostingQueryBuilder extends BaseQueryBuilder {
|
||||||
if (boost != -1) {
|
if (boost != -1) {
|
||||||
builder.field("boost", boost);
|
builder.field("boost", boost);
|
||||||
}
|
}
|
||||||
|
builder.endObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue