From 95f38171827d534afd7922b4a9aa12188418f1d3 Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 31 Aug 2015 17:42:19 +0200 Subject: [PATCH] Internal: simplify SimpleQueryStringBuilder#doXContent method No need to test for null values in fieldsAndWeights map, we use 1.0f a default boost all the time. --- .../index/query/SimpleQueryStringBuilder.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java b/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java index 87f68cd0d92..65727d5dbcd 100644 --- a/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java @@ -63,6 +63,8 @@ public class SimpleQueryStringBuilder extends AbstractQueryBuilder 0) { builder.startArray("fields"); for (Map.Entry entry : fieldsAndWeights.entrySet()) { - String field = entry.getKey(); - Float boost = entry.getValue(); - if (boost != null) { - builder.value(field + "^" + boost); - } else { - builder.value(field); - } + builder.value(entry.getKey() + "^" + entry.getValue()); } builder.endArray(); }