[
https://issues.apache.org/jira/browse/SOLR-8097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jason Gerlowski updated SOLR-8097:
----------------------------------
Attachment: SOLR-8097.patch
I've attached a first pass at the creation of a {{CloudSolrClientBuilder}}
class. The attached patch contains the builder class, an added
{{CloudSolrClient}} ctor that takes all parameters, and some basic tests for
the builder and new ctor.
Some notes on the patch:
- patch is off of trunk/master. I assume we'd also want it in 5.x, but one
thing at a time...
- created two small helper methods in {{CloudSolrClient}}. Maybe I
shouldn't've done that, but I found myself copy-pasting the code, so it seemed
like the right thing to do at the time. Happy to change if necessary.
- I didn't change any other code in the project to actually _use_ the new
builder. I'm happy to do this, just wasn't sure it was the right thing and
wanted to wait on feedback from others.
- I didn't touch (delete, re-scope, deprecate, etc.) any of the existing ctors.
I assume an eventual version of this patch on 5.x should deprecate the
existing ctors. Should I also have the ctors be deprecated in the trunk/master
version? Or should I do something more aggressive, like deleting them
altogether? Happy to do whatever; just wasn't entirely sure what the right
move was (even after [~elyograg] addressed my earlier, less directed questions
above...thanks btw).
All-in-all, the patch still needs a bit of work, but should be a solid start.
Looking forward to hearing what people think/want-changed!
> Implement a builder pattern for constructing a Solrj client
> -----------------------------------------------------------
>
> Key: SOLR-8097
> URL: https://issues.apache.org/jira/browse/SOLR-8097
> Project: Solr
> Issue Type: Improvement
> Components: SolrJ
> Affects Versions: Trunk
> Reporter: Hrishikesh Gadre
> Priority: Minor
> Attachments: SOLR-8097.patch
>
>
> Currently Solrj clients (e.g. CloudSolrClient) supports multiple constructors
> as follows,
> public CloudSolrClient(String zkHost)
> public CloudSolrClient(String zkHost, HttpClient httpClient)
> public CloudSolrClient(Collection<String> zkHosts, String chroot)
> public CloudSolrClient(Collection<String> zkHosts, String chroot, HttpClient
> httpClient)
> public CloudSolrClient(String zkHost, boolean updatesToLeaders)
> public CloudSolrClient(String zkHost, boolean updatesToLeaders, HttpClient
> httpClient)
> It is kind of problematic while introducing an additional parameters (since
> we need to introduce additional constructors). Instead it will be helpful to
> provide SolrClient Builder which can provide either default values or support
> overriding specific parameter.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]