-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 8.6
-
Fix Version/s: 8.7, master (9.0)
-
Component/s: clients - java
-
Labels:None
A naive approach to using CloudSolrClient, such as on this page: http://joelsolr.blogspot.com/2015/04/the-streaming-api-solrjio-basics.html - will not work: opening the stream will throw an IOException with an embedded NullPointerException.
This took me a while to figure out, and I think it would be good to either update the documentation or "fix" the constructor to set the needed streamContext as appropriate.
I found this snippet of code in TuppleStream.java, that seems to "almost" work without a streamContext:
// line 127 in the sources to TuppleStream.java: public static List<String> getShards(String zkHost, String collection, StreamContext streamContext, SolrParams requestParams) ... // line 135 if(streamContext != null) { shardsMap = (Map<String, List<String>>)streamContext.get("shards"); } ... // line 144 CloudSolrClient cloudSolrClient = Optional.ofNullable(streamContext.getSolrClientCache()).orElseGet(SolrClientCache::new).getCloudSolrClient(zkHost);
if streamContext is null in the last statement, a NullPointerException will be thrown and open'ening the stream will fail.
This took me way too long time to figure out.
- links to