Solr
  1. Solr
  2. SOLR-4217

post.jar ignores -Dparams when -Durl is used

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: update
    • Labels:
      None

      Description

      When post.jar is used with a custom URL (e.g. for multi-core), it silently ignores -Dparams flag and requires parameters to be appended directly to -Durl value.

      The problem is the following code:
      String params = System.getProperty("params", "");
      urlStr = System.getProperty("url", SimplePostTool.appendParam(DEFAULT_POST_URL, params));

      The workaround exists (by using -Durl="http://customurl?param1=value&param2=value"), but it is both undocumented as a special case and clunky as Url and params may be coming from different places. It would be good to have this consistent.

      1. SOLR-4217.patch
        2 kB
        Erik Hatcher

        Activity

        Hide
        Alexandre Rafalovitch added a comment -

        Would it be possible to fit this into 4.1? I am trying to use this for an example and it is very clunky with the current workaround:
        java -Dauto -Durl="http://localhost:8983/solr/multivalued/update?f.to.split=true&f.to.separator=;" -jar post.jar multivalued/multivalued.csv

        The example should be out after 4.1, but it will not wait until 4.2....

        The change should be trivial, something like:
        -------------
        urlStr = System.getProperty("url")
        if (urlStr == null)

        { urlStr = SimplePostTool.appendParam(DEFAULT_POST_URL, params); }

        else

        { urlStr = SimplePostTool.appendParam(urlStr, params); }

        -------------

        I just don't have the environment setup to do full patch myself yet.

        Show
        Alexandre Rafalovitch added a comment - Would it be possible to fit this into 4.1? I am trying to use this for an example and it is very clunky with the current workaround: java -Dauto -Durl="http://localhost:8983/solr/multivalued/update?f.to.split=true&f.to.separator=;" -jar post.jar multivalued/multivalued.csv The example should be out after 4.1, but it will not wait until 4.2.... The change should be trivial, something like: ------------- urlStr = System.getProperty("url") if (urlStr == null) { urlStr = SimplePostTool.appendParam(DEFAULT_POST_URL, params); } else { urlStr = SimplePostTool.appendParam(urlStr, params); } ------------- I just don't have the environment setup to do full patch myself yet.
        Hide
        Erik Hatcher added a comment -

        Alexandre - here's a patch I believe solves the problem. I added a test case too. Thanks for opening the issue. I'll commit this to trunk and 4x, so it'll make it to 4.1

        Show
        Erik Hatcher added a comment - Alexandre - here's a patch I believe solves the problem. I added a test case too. Thanks for opening the issue. I'll commit this to trunk and 4x, so it'll make it to 4.1
        Hide
        Erik Hatcher added a comment -

        Alexandre - thanks for bringing up this issue and showing the way to the fix clearly. I've just committed to trunk and 4x.

        Show
        Erik Hatcher added a comment - Alexandre - thanks for bringing up this issue and showing the way to the fix clearly. I've just committed to trunk and 4x.
        Hide
        Jan Høydahl added a comment -

        I saw this the other day too, thanks for reporting and fixing!

        Show
        Jan Høydahl added a comment - I saw this the other day too, thanks for reporting and fixing!

          People

          • Assignee:
            Erik Hatcher
            Reporter:
            Alexandre Rafalovitch
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development