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

Parameter substitution (MacroExpander) Map expand issue

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0.1
    • Fix Version/s: 6.4
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

        @Test
        public void testMap() {
          final Map<String,String[]> request = new HashMap<String,String[]>();
          request.put("fq", new String[] {"${one_ref}","two"});
          request.put("one_ref",new String[] {"one"});
          Map expanded = MacroExpander.expand(request);
          assertEquals("one", ((String[])expanded.get("fq"))[0]);
          assertEquals("two", ((String[]) expanded.get("fq"))[1]);
        }
      

      fails with `java.lang.ArrayIndexOutOfBoundsException` because the resultant `expanded` structure only has a single "fq" value of "one". "two" got eaten.

      1. SOLR-9740.patch
        2 kB
        Yonik Seeley

        Activity

        Hide
        ehatcher Erik Hatcher added a comment - - edited

        this seems like a critical bug - we're seeing it eat fq's for real, when we're doing a

        &fq=range_field:[${lower} TO ${upper}]&fq=category:value

        type of request.

        Show
        ehatcher Erik Hatcher added a comment - - edited this seems like a critical bug - we're seeing it eat fq's for real, when we're doing a &fq=range_field:[${lower} TO ${upper}]&fq=category:value type of request.
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        Yikes! I'll take a look...

        Show
        yseeley@gmail.com Yonik Seeley added a comment - Yikes! I'll take a look...
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        Yeah, so the bug causes all non-templated values after the first templated value would be dropped in a multi-valued argument.

        Here's a patch + test. I'll commit shortly.

        Show
        yseeley@gmail.com Yonik Seeley added a comment - Yeah, so the bug causes all non-templated values after the first templated value would be dropped in a multi-valued argument. Here's a patch + test. I'll commit shortly.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 11840469d9716b3fdb0303645475db2b8def1522 in lucene-solr's branch refs/heads/master from Yonik Seeley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=1184046 ]

        SOLR-9740: fix macro expansion of multi-valued parameters

        Show
        jira-bot ASF subversion and git services added a comment - Commit 11840469d9716b3fdb0303645475db2b8def1522 in lucene-solr's branch refs/heads/master from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=1184046 ] SOLR-9740 : fix macro expansion of multi-valued parameters
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 768b7ff8f582b14d787563703eb3bd65388d9fac in lucene-solr's branch refs/heads/branch_6x from Yonik Seeley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=768b7ff ]

        SOLR-9740: fix macro expansion of multi-valued parameters

        Show
        jira-bot ASF subversion and git services added a comment - Commit 768b7ff8f582b14d787563703eb3bd65388d9fac in lucene-solr's branch refs/heads/branch_6x from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=768b7ff ] SOLR-9740 : fix macro expansion of multi-valued parameters
        Hide
        ehatcher Erik Hatcher added a comment -

        Thanks for the quick fix, Yonik!

        Show
        ehatcher Erik Hatcher added a comment - Thanks for the quick fix, Yonik!

          People

          • Assignee:
            yseeley@gmail.com Yonik Seeley
            Reporter:
            ehatcher Erik Hatcher
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development