From e7099e4bf51bd87ed95a188c474be869c222379d Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Fri, 26 May 2017 10:51:41 +0100 Subject: [PATCH] SOLR-10741: Factor out createSliceShardsStr method from HttpShardHandler.prepDistributed. (Domenico Fabio Marino via Christine Poerschke) --- solr/CHANGES.txt | 3 +++ .../handler/component/HttpShardHandler.java | 26 +++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 1da3fe0ba0f..d2f42e65c15 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -263,6 +263,9 @@ Other Changes * SOLR-10659: Remove ResponseBuilder.getSortSpec use in SearchGroupShardResponseProcessor. (Judith Silverman via Christine Poerschke) +* SOLR-10741: Factor out createSliceShardsStr method from HttpShardHandler.prepDistributed. + (Domenico Fabio Marino via Christine Poerschke) + ================== 6.6.0 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java index 4ec3b7924f4..bc620b61418 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java @@ -449,17 +449,7 @@ public class HttpShardHandler extends ShardHandler { } } // And now recreate the | delimited list of equivalent servers - final StringBuilder sliceShardsStr = new StringBuilder(); - boolean first = true; - for (String shardUrl : shardUrls) { - if (first) { - first = false; - } else { - sliceShardsStr.append('|'); - } - sliceShardsStr.append(shardUrl); - } - rb.shards[i] = sliceShardsStr.toString(); + rb.shards[i] = createSliceShardsStr(shardUrls); } } String shards_rows = params.get(ShardParams.SHARDS_ROWS); @@ -472,6 +462,20 @@ public class HttpShardHandler extends ShardHandler { } } + private static String createSliceShardsStr(final List shardUrls) { + final StringBuilder sliceShardsStr = new StringBuilder(); + boolean first = true; + for (String shardUrl : shardUrls) { + if (first) { + first = false; + } else { + sliceShardsStr.append('|'); + } + sliceShardsStr.append(shardUrl); + } + return sliceShardsStr.toString(); + } + private void addSlices(Map target, ClusterState state, SolrParams params, String collectionName, String shardKeys, boolean multiCollection) { DocCollection coll = state.getCollection(collectionName);