Source:
<code>private String assemble() { if (limit > 0) { if (size > limit) { size = limit; } } Map<String, String> uriParams = new LinkedHashMap<String, String>(); StringBuilder sb = new StringBuilder(); sb.append(indices); if (StringUtils.hasLength(types)) { sb.append("/"); sb.append(types); } sb.append("/_search?"); if (version.onOrAfter(EsMajorVersion.V_5_X)) { uriParams.put("sort", "_doc"); } else { uriParams.put("search_type", "scan"); } uriParams.put("scroll", String.valueOf(scroll.toString())); uriParams.put("size", String.valueOf(size)); if (includeVersion) { uriParams.put("version", "true"); } StringBuilder pref = new StringBuilder(); if (StringUtils.hasText(shard)) { pref.append("_shards:"); pref.append(shard); } <START> if (!preference.isEmpty() || local) { <END> if (pref.length() > 0) { if (version.onOrAfter(EsMajorVersion.V_5_X)) { pref.append("|"); } else { pref.append(";"); } } if (!preference.isEmpty()) { pref.append(preference); } else { pref.append("_local"); } } if (pref.length() > 0) { uriParams.put("preference", HttpEncodingTools.encode(pref.toString())); } if (routing != null) { uriParams.put("routing", HttpEncodingTools.encode(routing)); } if (readMetadata) { uriParams.put("track_scores", "true"); } for (Iterator<Entry<String, String>> it = uriParams.entrySet().iterator(); it.hasNext();) { Entry<String, String> entry = it.next(); sb.append(entry.getKey()); if (StringUtils.hasText(entry.getValue())) { sb.append("="); sb.append(entry.getValue()); } if (it.hasNext()) { sb.append("&"); } } return sb.toString(); }</code><technical_language>suggestion if (!StringUtils.hasText(preference) || local) { a user place a blank space in</technical_language>

Target:
private String assemble() { if (limit > 0) { if (size > limit) { size = limit; } } Map<String, String> uriParams = new LinkedHashMap<String, String>(); StringBuilder sb = new StringBuilder(); sb.append(indices); if (StringUtils.hasLength(types)) { sb.append("/"); sb.append(types); } sb.append("/_search?"); if (version.onOrAfter(EsMajorVersion.V_5_X)) { uriParams.put("sort", "_doc"); } else { uriParams.put("search_type", "scan"); } uriParams.put("scroll", String.valueOf(scroll.toString())); uriParams.put("size", String.valueOf(size)); if (includeVersion) { uriParams.put("version", "true"); } StringBuilder pref = new StringBuilder(); if (StringUtils.hasText(shard)) { pref.append("_shards:"); pref.append(shard); } if (local || StringUtils.hasText(preference)) { if (pref.length() > 0) { if (version.onOrAfter(EsMajorVersion.V_5_X)) { pref.append("|"); } else { pref.append(";"); } } if (StringUtils.hasText(preference)) { pref.append(preference); } else { pref.append("_local"); } } if (pref.length() > 0) { uriParams.put("preference", HttpEncodingTools.encode(pref.toString())); } if (routing != null) { uriParams.put("routing", HttpEncodingTools.encode(routing)); } if (readMetadata) { uriParams.put("track_scores", "true"); } for (Iterator<Entry<String, String>> it = uriParams.entrySet().iterator(); it.hasNext();) { Entry<String, String> entry = it.next(); sb.append(entry.getKey()); if (StringUtils.hasText(entry.getValue())) { sb.append("="); sb.append(entry.getValue()); } if (it.hasNext()) { sb.append("&"); } } return sb.toString(); }