From 6d108e77f15466105a9f10334f2868a05ef7dd3e Mon Sep 17 00:00:00 2001 From: kimchy Date: Sun, 13 Mar 2011 00:37:25 +0200 Subject: [PATCH] handle whitespace text on search fields query string parameter to be treated as no fields --- .../org/elasticsearch/rest/action/search/RestSearchAction.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index 4a03405a399..6b5a80f9081 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -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);