[ https://issues.apache.org/jira/browse/SOLR-11629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16247844#comment-16247844 ]
Jason Gerlowski commented on SOLR-11629: ---------------------------------------- I like the idea here, but it's a little tricky for {{CloudSolrClient}}, since zk-host and Solr-URL are both String values. Java won't let you have two constructors, with the same signature, so the straightforward approach won't compile: {code} public Builder(String solrUrl) {...} public Builder(String zkHost) {...} {code} We could do something fancier, like introduce SolrUrl and ZkHost String-subtypes, but that would require uses to wrap their String-literal in a {{new SolrUrl("....")}} declaration just to work around the type system. Would clarify which parameters were "required", but also adds some user-irritation. I'm ambivalent on whether or not it's worth it. If no code solution presents itself here, maybe our best bet is just some Javadoc improvement. > CloudSolrClient.Builder should accept a zk host > ----------------------------------------------- > > Key: SOLR-11629 > URL: https://issues.apache.org/jira/browse/SOLR-11629 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Reporter: Varun Thacker > > Today we need to create an empty builder and then wither pass zkHost or > withSolrUrl > {code} > SolrClient solrClient = new > CloudSolrClient.Builder().withZkHost("localhost:9983").build(); > solrClient.request(updateRequest, "gettingstarted"); > {code} > What if we have two constructors , one that accepts a zkHost and one that > accepts a SolrUrl . > The advantages that I can think of are: > - It will be obvious to users that we support two mechanisms of creating a > CloudSolrClient . The SolrUrl option is cool and applications don't need to > know about ZooKeeper and new users will learn about this . Maybe our > example's on the ref guide should use this? > - Today people can set both zkHost and solrUrl but CloudSolrClient can only > utilize one of them > HttpClient's Builder accepts the host > {code} > HttpSolrClient client = new > HttpSolrClient.Builder("http://localhost:8983/solr").build(); > client.request(updateRequest, "techproducts"); > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org