[ https://issues.apache.org/jira/browse/SOLR-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513381#comment-16513381 ]
Philip Pock commented on SOLR-10428: ------------------------------------ Works as expected with version 7.2.0 and 7.3.1 > CloudSolrClient: Qerying multiple collection aliases leads to SolrException: > Collection not found > ------------------------------------------------------------------------------------------------- > > Key: SOLR-10428 > URL: https://issues.apache.org/jira/browse/SOLR-10428 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Components: SolrJ > Affects Versions: 6.4, 6.4.1, 6.4.2, 6.5, 7.0 > Reporter: Philip Pock > Priority: Minor > > We have multiple collections and an alias is created for each of them. e.g.: > alias-a -> collection-a, alias-b -> collection-b > We search in multiple collections by passing the aliases of the collections > in the collections parameter. > {code}solrClient.query("alias-a,alias-b", params, > SolrRequest.METHOD.POST){code} > The client can't find the collection and throws an Exception. Relevant parts > of the stacktrace using v6.5.0: > {noformat} > org.apache.solr.common.SolrException: Collection not found: collection-a > at > org.apache.solr.client.solrj.impl.CloudSolrClient.getCollectionNames(CloudSolrClient.java:1394) > at > org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:1087) > at > org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:1057) > at > org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:160) > at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:974) > {noformat} > Everything works fine with a single alias. > I think this issue was introduced with SOLR-9784. Please see my comment below. > {code:title=org.apache.solr.client.solrj.impl.CloudSolrClient } > Set<String> getCollectionNames(String collection) { > List<String> rawCollectionsList = StrUtils.splitSmart(collection, ",", > true); > Set<String> collectionNames = new HashSet<>(); > for (String collectionName : rawCollectionsList) { > if (stateProvider.getState(collectionName) == null) { > // I assume that collectionName should be passed to getAlias here > String alias = stateProvider.getAlias(collection); > if (alias != null) { > List<String> aliasList = StrUtils.splitSmart(alias, ",", true); > collectionNames.addAll(aliasList); > continue; > } > throw new SolrException(ErrorCode.BAD_REQUEST, "Collection not > found: " + collectionName); > } > collectionNames.add(collectionName); > } > return collectionNames; > } > {code} > The suggested change is similar to the previous revision: > https://github.com/apache/lucene-solr/commit/5650939a8d41b7bad584947a2c9dcedf3774b8de#diff-c8d54eacd46180b332c86c7ae448abaeL1301 -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org