Search failure when no results are found and sorting by score, closes #362.

This commit is contained in:
kimchy 2010-09-09 15:47:55 +03:00
parent 31362e4c60
commit b31b0e979c
1 changed files with 2 additions and 2 deletions

View File

@ -101,8 +101,8 @@ public class SearchPhaseController {
break;
}
}
if (!resolvedField && allValuesAreNull) {
// we did not manage to resolve a field, and all the fields are null (which can only happen for STRING), make it a STRING
if (!resolvedField && allValuesAreNull && fieldDocs.fields[i].getField() != null) {
// we did not manage to resolve a field (and its not score or doc, which have no field), and all the fields are null (which can only happen for STRING), make it a STRING
fieldDocs.fields[i] = new SortField(fieldDocs.fields[i].getField(), SortField.STRING, fieldDocs.fields[i].getReverse());
}
}