Solr
  1. Solr
  2. SOLR-6543

Give HttpSolrServer the ability to send PUT requests

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0, 6.0
    • Component/s: SolrJ
    • Labels:
      None

      Description

      Given that the schema API has a PUT request (https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Createonenewschemafield) it would be nice if HttpSolrServer supported sending PUTs, so it could be used for sending that type of request. Note if we really wanted to fully support that request we'd probably want a Request/Response type in solrj as well, but that can be handled in a separate issue.

      Also, administrators may add arbitrary filters that require PUT requests. In my own setup, I have a version of Hadoop's DelegationTokenAuthenticationFilter sitting in front of the dispatch filter. Here also it would be nice if I could send all requests via HttpSolrServer.

      1. SOLR-6543.patch
        11 kB
        Gregory Chanan
      2. SOLR-6543.patch
        10 kB
        Gregory Chanan

        Activity

        Hide
        Gregory Chanan added a comment -

        Here's a patch with a unit test. Note I only changed the client side. On the server side, we may eventually want to support better parsing in SolrRequestParsers (right now, only the queryString of puts are parsed) and to handle the caching in HttpCacheHeaderUtil. But since puts are only used in the schema API, and that is handled by the REST API that doesn't use those classes, this is sufficient.

        Show
        Gregory Chanan added a comment - Here's a patch with a unit test. Note I only changed the client side. On the server side, we may eventually want to support better parsing in SolrRequestParsers (right now, only the queryString of puts are parsed) and to handle the caching in HttpCacheHeaderUtil. But since puts are only used in the schema API, and that is handled by the REST API that doesn't use those classes, this is sufficient.
        Hide
        Gregory Chanan added a comment -

        One thing I noticed reading over the previous patch again: there's a useMultiPartPost setting, but I use it for put requests. A multipart PUT seems pretty rare, so I'll just leave the setting name as is and make sure it's only used with POST requests. Attached patch does this.

        Show
        Gregory Chanan added a comment - One thing I noticed reading over the previous patch again: there's a useMultiPartPost setting, but I use it for put requests. A multipart PUT seems pretty rare, so I'll just leave the setting name as is and make sure it's only used with POST requests. Attached patch does this.
        Hide
        Noble Paul added a comment -

        We are going to move the schema API to the new syntax SOLR-6476. Even for config we are going implement the new bulk API syntax SOLR-6533 .I don't know how relevant this will be after it is committed

        Show
        Noble Paul added a comment - We are going to move the schema API to the new syntax SOLR-6476 . Even for config we are going implement the new bulk API syntax SOLR-6533 .I don't know how relevant this will be after it is committed
        Hide
        Gregory Chanan added a comment -

        Noble Paul thanks for pointing that out. Do you think it's still reasonable to commit this? My "arbitrary filters" argument still applies, i.e. I may have added my own filters that require PUT requests and for convenience and standard error handling, I want to define my own Request/Response classes to handle those requests via solrj the same as any other requests. Though I guess that argues for supporting all HTTP methods, though PUT is probably the most common.

        Show
        Gregory Chanan added a comment - Noble Paul thanks for pointing that out. Do you think it's still reasonable to commit this? My "arbitrary filters" argument still applies, i.e. I may have added my own filters that require PUT requests and for convenience and standard error handling, I want to define my own Request/Response classes to handle those requests via solrj the same as any other requests. Though I guess that argues for supporting all HTTP methods, though PUT is probably the most common.
        Hide
        Mark Miller added a comment -

        I'm +1 on this patch. It's a fairly simple extension that has current value and is well tested. Who knows what will happen when in any given future release - this patch does not create a long term burden in my opinion and has current value though.

        Show
        Mark Miller added a comment - I'm +1 on this patch. It's a fairly simple extension that has current value and is well tested. Who knows what will happen when in any given future release - this patch does not create a long term burden in my opinion and has current value though.
        Hide
        Noble Paul added a comment -

        +1 ,for the feature

        Show
        Noble Paul added a comment - +1 ,for the feature
        Hide
        ASF subversion and git services added a comment -

        Commit 1627460 from gchanan@apache.org in branch 'dev/trunk'
        [ https://svn.apache.org/r1627460 ]

        SOLR-6543: Give HttpSolrServer the ability to send PUT requests

        Show
        ASF subversion and git services added a comment - Commit 1627460 from gchanan@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1627460 ] SOLR-6543 : Give HttpSolrServer the ability to send PUT requests
        Hide
        ASF subversion and git services added a comment -

        Commit 1627464 from gchanan@apache.org in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1627464 ]

        SOLR-6543: Give HttpSolrServer the ability to send PUT requests

        Show
        ASF subversion and git services added a comment - Commit 1627464 from gchanan@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1627464 ] SOLR-6543 : Give HttpSolrServer the ability to send PUT requests
        Hide
        Anshum Gupta added a comment -

        Bulk close after 5.0 release.

        Show
        Anshum Gupta added a comment - Bulk close after 5.0 release.

          People

          • Assignee:
            Gregory Chanan
            Reporter:
            Gregory Chanan
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development