lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [28/36] lucene-solr:jira/solr-8593: SOLR-9740: fix macro expansion of multi-valued parameters
Date Thu, 10 Nov 2016 21:15:58 GMT
SOLR-9740: fix macro expansion of multi-valued parameters


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/11840469
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/11840469
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/11840469

Branch: refs/heads/jira/solr-8593
Commit: 11840469d9716b3fdb0303645475db2b8def1522
Parents: da841be
Author: yonik <yonik@apache.org>
Authored: Tue Nov 8 18:01:02 2016 -0500
Committer: yonik <yonik@apache.org>
Committed: Tue Nov 8 18:09:43 2016 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                       |  5 +++++
 .../org/apache/solr/request/macro/MacroExpander.java   |  2 ++
 .../apache/solr/request/macro/TestMacroExpander.java   | 13 +++++++++++++
 3 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/11840469/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index dc24cf5..d2aeadb 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -136,6 +136,11 @@ Bug Fixes
   of matching something due to filter exclusions (which can widen the domain again).
   (Michael Sun, yonik)
 
+* SOLR-9740: A bug in macro expansion of multi-valued parameters caused non-expanded values
+  after the first expanded value in the same multi-valued parameter to be dropped.
+  (Erik Hatcher, yonik)
+
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/11840469/solr/core/src/java/org/apache/solr/request/macro/MacroExpander.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/macro/MacroExpander.java b/solr/core/src/java/org/apache/solr/request/macro/MacroExpander.java
index 305a975..9d432fa 100644
--- a/solr/core/src/java/org/apache/solr/request/macro/MacroExpander.java
+++ b/solr/core/src/java/org/apache/solr/request/macro/MacroExpander.java
@@ -71,6 +71,8 @@ public class MacroExpander {
               newValues.add(vv);
             }
           }
+        }
+        if (newValues != null) {
           newValues.add(newV);
         }
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/11840469/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java b/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java
index 5b16a11..e908037 100644
--- a/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java
+++ b/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java
@@ -113,4 +113,17 @@ public class TestMacroExpander extends LuceneTestCase {
     }
   }
 
+  @Test
+  public void testMap() { // see SOLR-9740, the second fq param was being dropped.
+    final Map<String,String[]> request = new HashMap<>();
+    request.put("fq", new String[] {"zero", "${one_ref}", "two", "${three_ref}"});
+    request.put("one_ref",new String[] {"one"});
+    request.put("three_ref",new String[] {"three"});
+    Map expanded = MacroExpander.expand(request);
+    assertEquals("zero", ((String[])expanded.get("fq"))[0]);
+    assertEquals("one", ((String[])expanded.get("fq"))[1]);
+    assertEquals("two", ((String[]) expanded.get("fq"))[2]);
+    assertEquals("three", ((String[]) expanded.get("fq"))[3]);
+  }
+
 }


Mime
View raw message