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

EmbeddedSolrServer does not support SchemaAPI

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.4.1
    • Fix Version/s: 6.5, 7.0
    • Component/s: Server, SolrJ
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
    • Flags:
      Important

      Description

      The EmbeddedSolrServer server does not support calls to the POST methods of SchemaAPI using SolRJ api. The reason is that the httpMethod param is never set by the EmbeddedSolrServer#request(SolrRequest, String) and this is later required by the SchemaHandler class that actually performs the call at SchemaHandler#handleRequestBody(SolrQueryRequest, SolrQueryResponse).

      Proposal is to enhance the EmbeddedSolrServer to forward the httpMethod at aprox row 174 with the following: "req.getContext().put("httpMethod", request.getMethod().name());". This change requires the Factory methods of SolrJ to add the intended method to be used example : new SchemaRequest.AddField(....) should append the POST method similar to how the SchemaRequest.Field appends the GET method.

      I have written a separate EmbeddedSolrServer that replaces the one in SolR. It works for now and fields can be created on the fly using the SchemaAPI of the solrj client, but would like to be able to remove this workaround.

      1. SOLR-10134.patch
        14 kB
        Mikhail Khludnev
      2. SOLR-10134.patch
        9 kB
        Mikhail Khludnev
      3. SOLR-10134.patch
        1 kB
        Robert Alexandersson

        Issue Links

          Activity

          Hide
          mkhludnev Mikhail Khludnev added a comment -

          can you create a patch?

          Show
          mkhludnev Mikhail Khludnev added a comment - can you create a patch?
          Hide
          robert_alex Robert Alexandersson added a comment -
          Show
          robert_alex Robert Alexandersson added a comment - Path uploaded and can be found here as well: https://github.com/alero/lucene-solr/commit/3603832e3d4fdb3bfe3fa9eb27202b71dda4e068
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          Robert Alexandersson, can you also contribute a test?

          Show
          mkhludnev Mikhail Khludnev added a comment - Robert Alexandersson , can you also contribute a test?
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user alero opened a pull request:

          https://github.com/apache/lucene-solr/pull/158

          SOLR-10134 - Support SchemaAPI in EmbeddedSolrServer

          Adds support for changing the schema in mutable mode and using EmbeddedSolrServer

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/alero/lucene-solr master

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/lucene-solr/pull/158.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #158


          commit 3603832e3d4fdb3bfe3fa9eb27202b71dda4e068
          Author: Robert Alexandersson <robert.alexandersson@gmail.com>
          Date: 2017-02-16T16:06:20Z

          SOLR-10134

          Added the httpMethod param to context so SolR SchemaAPI can handle POST calls

          commit 6de410703d0e1be497289017ca1e1c1c4d8303bd
          Author: Robert Alexandersson <robert.alexandersson@gmail.com>
          Date: 2017-02-17T07:54:43Z

          SOLR-10134

          Added testcase and enabled the SchemaHandler to parse the incoming command

          commit 09559122d445aa4efa4cf9beffa6622120fe5f6f
          Author: Robert Alexandersson <robert.alexandersson@gmail.com>
          Date: 2017-02-17T07:59:25Z

          SOLR-10134

          Added testcase and enabled the SchemaHandler to parse the incoming command

          commit dc02bcf8de62169dbbe9674c5d5f899c5064e37c
          Author: Robert Alexandersson <robert.alexandersson@gmail.com>
          Date: 2017-02-17T09:03:00Z

          SOLR-10134

          Improved the test case and added a failing test for immutable config


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user alero opened a pull request: https://github.com/apache/lucene-solr/pull/158 SOLR-10134 - Support SchemaAPI in EmbeddedSolrServer Adds support for changing the schema in mutable mode and using EmbeddedSolrServer You can merge this pull request into a Git repository by running: $ git pull https://github.com/alero/lucene-solr master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/lucene-solr/pull/158.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #158 commit 3603832e3d4fdb3bfe3fa9eb27202b71dda4e068 Author: Robert Alexandersson <robert.alexandersson@gmail.com> Date: 2017-02-16T16:06:20Z SOLR-10134 Added the httpMethod param to context so SolR SchemaAPI can handle POST calls commit 6de410703d0e1be497289017ca1e1c1c4d8303bd Author: Robert Alexandersson <robert.alexandersson@gmail.com> Date: 2017-02-17T07:54:43Z SOLR-10134 Added testcase and enabled the SchemaHandler to parse the incoming command commit 09559122d445aa4efa4cf9beffa6622120fe5f6f Author: Robert Alexandersson <robert.alexandersson@gmail.com> Date: 2017-02-17T07:59:25Z SOLR-10134 Added testcase and enabled the SchemaHandler to parse the incoming command commit dc02bcf8de62169dbbe9674c5d5f899c5064e37c Author: Robert Alexandersson <robert.alexandersson@gmail.com> Date: 2017-02-17T09:03:00Z SOLR-10134 Improved the test case and added a failing test for immutable config
          Hide
          robert_alex Robert Alexandersson added a comment -

          I have added a test and noticed that the code had changed quite alot in this so needed to add change more to support the EmbeddedSolrServer requests. It does seem like you are in need of adding more tests in general for the EmbeddedSolrServer as it seems to get lost in the main "http" flows. The tests and code changes can be found in PR on github, https://github.com/apache/lucene-solr/pull/158

          Show
          robert_alex Robert Alexandersson added a comment - I have added a test and noticed that the code had changed quite alot in this so needed to add change more to support the EmbeddedSolrServer requests. It does seem like you are in need of adding more tests in general for the EmbeddedSolrServer as it seems to get lost in the main "http" flows. The tests and code changes can be found in PR on github, https://github.com/apache/lucene-solr/pull/158
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          Robert Alexandersson, the patch is great. I'm tweaking it a little to reduce test footprint. wip.

          Show
          mkhludnev Mikhail Khludnev added a comment - Robert Alexandersson , the patch is great. I'm tweaking it a little to reduce test footprint. wip.
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          feedback for SOLR-10134.patch is so welcomed!!

          Show
          mkhludnev Mikhail Khludnev added a comment - feedback for SOLR-10134.patch is so welcomed!!
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 0baf2fa33cef485df94649fd408c22e6430b68cf in lucene-solr's branch refs/heads/master from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=0baf2fa ]

          SOLR-10134: EmbeddedSolrServer handles SchemaAPI requests

          Show
          jira-bot ASF subversion and git services added a comment - Commit 0baf2fa33cef485df94649fd408c22e6430b68cf in lucene-solr's branch refs/heads/master from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=0baf2fa ] SOLR-10134 : EmbeddedSolrServer handles SchemaAPI requests
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit bce1417fceeed2054f16565e96dc49268c1b2ea1 in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=bce1417 ]

          SOLR-10134: EmbeddedSolrServer handles SchemaAPI requests

          Show
          jira-bot ASF subversion and git services added a comment - Commit bce1417fceeed2054f16565e96dc49268c1b2ea1 in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=bce1417 ] SOLR-10134 : EmbeddedSolrServer handles SchemaAPI requests
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          We've done! Robert Alexandersson, happy testing!

          Show
          mkhludnev Mikhail Khludnev added a comment - We've done! Robert Alexandersson , happy testing!

            People

            • Assignee:
              Unassigned
              Reporter:
              robert_alex Robert Alexandersson
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development