Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-12309

CloudSolrClient.Builder constructors are not well documented

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 7.3
    • None
    • clients - java
    • None

    Description

      I was having a lot of trouble figuring out how to create a CloudSolrClient object without using deprecated code.

      The no-arg constructor on the Builder object is deprecated, and the two remaining methods have similar signatures to each other. It is not at all obvious how to successfully call the one that uses ZooKeeper to connect. The javadoc is silent on the issue. I did finally figure it out with a lot of googling, and I would like to save others the hassle.

      I believe that this is what the javadoc for the third ctor should say:


      Provide a series of ZooKeeper hosts which will be used when configuring CloudSolrClient instances. Optionally, include a chroot to be used when accessing the ZooKeeper database.

      Here are a couple of examples. The first one has no chroot, the second one does:

      new CloudSolrClient.Builder(zkHosts, Optional.empty())
      new CloudSolrClient.Builder(zkHosts, Optional.of("/solr"))


      The javadoc for the URL-based method should probably say something to indicate that it is easy to confuse with the ZK-based method.

      I have not yet looked at the current reference guide to see if that has any clarification.

      Is it a good idea to completely eliminate the ability to create a cloud client using a single string that matches the zkHost value used when starting Solr in cloud mode?

      Attachments

        1. SOLR-12309.patch
          3 kB
          Jason Gerlowski
        2. fluent-builder-fail-compile-time.patch
          13 kB
          Shawn Heisey

        Activity

          People

            Unassigned Unassigned
            elyograg Shawn Heisey
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: