max_score == NaN, closes #263.

This commit is contained in:
kimchy 2010-07-17 01:39:12 +03:00
parent 3006183191
commit e61dc78c21
2 changed files with 7 additions and 1 deletions

View File

@ -2,10 +2,12 @@
<dictionary name="kimchy">
<words>
<w>addr</w>
<w>amazonaws</w>
<w>appendable</w>
<w>args</w>
<w>asciifolding</w>
<w>attr</w>
<w>auth</w>
<w>banon</w>
<w>bindhost</w>
<w>birthdate</w>

View File

@ -98,7 +98,11 @@ public class InternalSearchHits implements SearchHits {
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject("hits");
builder.field("total", totalHits);
if (Float.isNaN(maxScore)) {
builder.nullField("max_score");
} else {
builder.field("max_score", maxScore);
}
builder.field("hits");
builder.startArray();
for (SearchHit hit : hits) {