Java API: BoostingQueryBuilder does not build the query correctly, closes #1141.

This commit is contained in:
kimchy 2011-07-21 09:18:17 +03:00
parent ed6a6e31d3
commit 91e050f885
2 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,17 @@ import java.io.IOException;
*/
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 {
return buildAsUnsafeBytes(XContentType.JSON);
}

View File

@ -90,5 +90,6 @@ public class BoostingQueryBuilder extends BaseQueryBuilder {
if (boost != -1) {
builder.field("boost", boost);
}
builder.endObject();
}
}