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

Improve API path specifying in SolrJ

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • SolrJ, v2 API
    • None

    Description

      Currently, URL-driven SolrClients receive a URL that typically ends in "/solr". Requiring users to specify this context-root in their URLs has made sense historically, since all v1 paths start with "/solr". But this has become limiting as Solr's v2 APIs (which use the "/api" context root) become more mature.

      SolrJ has some string manipulation in a few spots to try to accomodate this, but it's patchy and relatively brittle (relying on overly specific 'instanceof' checks, etc.). We should come up with a more reliable way to ensure that SolrClient's can make both v1 and v2 requests.

      Here's one idea for how we could approach this:

      1. Create a new SolrRequest method to specify the initial path segment (i.e. /solr vs /api) on a per-request basis. We could either do this directly (e.g. "getRootPath()"), or indirectly (e.g. "isV2()").
      2. Modify SolrClients to consider both the new method and the existing "getPath" when sending requests.
      3. Add logic to SolrJ to strip "/solr" from any provided base URLs, and document that SolrClient URLs no longer require the "/solr" context-root suffix.

      Attachments

        Issue Links

          Activity

            People

              gerlowskija Jason Gerlowski
              gerlowskija Jason Gerlowski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: