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

Add a Solrj client constructor to accept custom SolrParams

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.10.3, 6.0
    • Fix Version/s: None
    • Component/s: SolrJ
    • Labels:
      None

      Description

      Solrj users can customize the Http client by overriding HttpClientConfigurer class (e.g. Krb5HttpClientConfigurer). But Solrj does not allow this customization at an individual SolrClient level. e.g. HttpSolrClient does not have a constructor which accepts default SolrParams which would be passed down to HttpClientUtil while creating an internal client.

      I observed this while working on supporting Basic authentication with Solr (4.10.3) version. As a work-around, I had to use external Http client support in Solr. e.g.

      ----------------------------BEFORE-----------------------------
      CloudSolrServer cloudSolrServer = new CloudSolrServer(zkEnsemble);

      -----------------------------AFTER-------------------------------
      ModifiableSolrParams solrParams = new ModifiableSolrParams();
      solrParams.set(HttpClientUtil.PROP_BASIC_AUTH_USER, getLdapUserName());
      solrParams.set(HttpClientUtil.PROP_BASIC_AUTH_PASS, getLdapUserPasswd());

      DefaultHttpClient client = (DefaultHttpClient) HttpClientUtil.createClient(solrParams);
      cloudSolrServer = new CloudSolrServer(zkEnsemble, new LBHttpSolrServer(client));
      --------------------------------------------------------------------------------------------------

      I think it would be great necessary constructors in the SolrClient implementations so that users can pass custom properties during initialization.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                hgadre Hrishikesh Gadre
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: