handle whitespace text on search fields query string parameter to be treated as no fields

This commit is contained in:
kimchy 2011-03-13 00:37:25 +02:00
parent aff8a4407f
commit 6d108e77f1
1 changed files with 2 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import org.elasticsearch.action.search.SearchOperationThreading;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -183,7 +184,7 @@ public class RestSearchAction extends BaseRestHandler {
String sField = request.param("fields");
if (sField != null) {
if (sField.length() == 0) {
if (!Strings.hasText(sField)) {
searchSourceBuilder.noFields();
} else {
String[] sFields = fieldsPattern.split(sField);