thelabdude commented on a change in pull request #2067: URL: https://github.com/apache/lucene-solr/pull/2067#discussion_r527027234
########## File path: solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java ########## @@ -334,88 +330,76 @@ private StreamComparator parseComp(String sort, String fl) throws IOException { public static Slice[] getSlices(String collectionName, ZkStateReader zkStateReader, boolean checkAlias) throws IOException { ClusterState clusterState = zkStateReader.getClusterState(); - Map<String, DocCollection> collectionsMap = clusterState.getCollectionsMap(); - - //TODO we should probably split collection by comma to query more than one - // which is something already supported in other parts of Solr - // check for alias or collection List<String> allCollections = new ArrayList<>(); String[] collectionNames = collectionName.split(","); + Aliases aliases = checkAlias ? zkStateReader.getAliases() : null; + for(String col : collectionNames) { - List<String> collections = checkAlias - ? zkStateReader.getAliases().resolveAliases(col) // if not an alias, returns collectionName + List<String> collections = (aliases != null) + ? aliases.resolveAliases(col) // if not an alias, returns collectionName : Collections.singletonList(collectionName); allCollections.addAll(collections); } // Lookup all actives slices for these collections List<Slice> slices = allCollections.stream() - .map(collectionsMap::get) + .map(c -> clusterState.getCollectionOrNull(c, true)) .filter(Objects::nonNull) .flatMap(docCol -> Arrays.stream(docCol.getActiveSlicesArr())) .collect(Collectors.toList()); if (!slices.isEmpty()) { - return slices.toArray(new Slice[slices.size()]); - } - - // Check collection case insensitive - for(Entry<String, DocCollection> entry : collectionsMap.entrySet()) { Review comment: I removed this b/c I don't think we should try to accommodate improperly cased collection names. No tests broke, but let me know if we need this for some reason I don't understand ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org