[jira] [Commented] (SOLR-10428) CloudSolrClient: Qerying multiple collection aliases leads to SolrException: Collection not found

2018-06-14 Thread Philip Pock (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 getCollectionNames(String collection) {
> List rawCollectionsList = StrUtils.splitSmart(collection, ",", 
> true);
> Set 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 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



[jira] [Commented] (SOLR-10428) CloudSolrClient: Qerying multiple collection aliases leads to SolrException: Collection not found

2018-06-13 Thread David Smiley (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16511215#comment-16511215
 ] 

David Smiley commented on SOLR-10428:
-

I improved this sort of stuff significantly in SOLR-11444.  "collection" can 
indeed be a list and potentially include aliases.  Even 
{{/solr/colA,colB/select?...}} works (as of SOLR-11444).  This isn't documented 
sufficiently, unfortunately. The SolrJ API could be improved here; should be a 
new issue.  Since it's so rare to specify more than one collection/alias, it 
just says "collection".  It's kinda a trick that it can be a list.

[~phpock] can you please try a more recent Solr version, 7.2.0 or beyond, and 
see if the problem persists?

> 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 getCollectionNames(String collection) {
> List rawCollectionsList = StrUtils.splitSmart(collection, ",", 
> true);
> Set 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 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



[jira] [Commented] (SOLR-10428) CloudSolrClient: Qerying multiple collection aliases leads to SolrException: Collection not found

2018-05-28 Thread Shawn Heisey (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16492891#comment-16492891
 ] 

Shawn Heisey commented on SOLR-10428:
-

The collection parameter that is mentioned on the wiki page you linked is a URL 
parameter.  To use that kind of syntax with SolrJ, you would use this code:

{code:java}
params.set("collection","alias-a,alias-b");
solrClient.query(params, SolrRequest.METHOD.POST)
{code}

The way your code supplies the collection parameter on the works differently.  
I think that SolrJ puts the provided collection into the URL path -- if you use 
, SolrJ sends to http://host:port/solr/ as the base URL.  I have not 
verified 100% that this is the case, but I think that is how it works.


> 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 getCollectionNames(String collection) {
> List rawCollectionsList = StrUtils.splitSmart(collection, ",", 
> true);
> Set 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 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



[jira] [Commented] (SOLR-10428) CloudSolrClient: Qerying multiple collection aliases leads to SolrException: Collection not found

2018-05-28 Thread Philip Pock (JIRA)

[ 
https://issues.apache.org/jira/browse/SOLR-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16492337#comment-16492337
 ] 

Philip Pock commented on SOLR-10428:


Sorry for the late reply. The only mention I could find about providing 
multiple collections in the parameter is fromĀ 
[https://wiki.apache.org/solr/SolrCloud#Distributed_Requests]
{quote}Query all shards of multiple compatible collections, explicitly 
specified:

http://localhost:8983/solr/collection1/select?collection=collection1_NY,collection1_NJ,collection1_CT
{quote}
I also think that "collection" should be changed to "collectionName".

> 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 getCollectionNames(String collection) {
> List rawCollectionsList = StrUtils.splitSmart(collection, ",", 
> true);
> Set 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 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



[jira] [Commented] (SOLR-10428) CloudSolrClient: Qerying multiple collection aliases leads to SolrException: Collection not found

2017-05-21 Thread Shawn Heisey (JIRA)

[ 
https://issues.apache.org/jira/browse/SOLR-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16018882#comment-16018882
 ] 

Shawn Heisey commented on SOLR-10428:
-

The javadoc for the query method you are talking about doesn't say 
"collections".  It says "collection".

http://lucene.apache.org/solr/6_5_1/solr-solrj/org/apache/solr/client/solrj/SolrClient.html#query-java.lang.String-org.apache.solr.common.params.SolrParams-org.apache.solr.client.solrj.SolrRequest.METHOD-

I've never heard any mention of being able to use a comma-separated list of 
collections in that parameter, but the presence of that getCollectionNames 
method suggests that my knowledge may have some holes.  If the intent really is 
to allow a list of collections, perhaps the javadoc on SolrClient needs a 
little work.  I wonder if a comma-separated list of cores would work with 
HttpSolrClient.

One thing that I know you CAN do with SolrCloud is create an alias on the 
server side that queries multiple collections in the cloud, and then only 
include that one alias in your query call.

I think I do see a bug in getCollectionNames.  In the master branch (as of 
right now), line 1409 says this:

{code}
String alias = stateProvider.getAlias(collection);
{code}

I believe that "collection" should be changed to "collectionName" in that line, 
and that this completely explains the behavior you're seeing. This code was 
added by the commit that you've referenced.


> 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, master (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 getCollectionNames(String collection) {
> List rawCollectionsList = StrUtils.splitSmart(collection, ",", 
> true);
> Set 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 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
(v6.3.15#6346)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org