lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject lucene-solr:branch_6x: SOLR-8458: Add Streaming Expressions tests for parameter substitution
Date Fri, 06 May 2016 14:39:00 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 219ddbb99 -> 4d15b9fa0


SOLR-8458: Add Streaming Expressions tests for parameter substitution


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

Branch: refs/heads/branch_6x
Commit: 4d15b9fa080cb95465338ec773a972559de7ec3d
Parents: 219ddbb
Author: Kevin Risden <krisden@apache.org>
Authored: Fri May 6 09:19:23 2016 -0500
Committer: Kevin Risden <krisden@apache.org>
Committed: Fri May 6 09:38:40 2016 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 +
 .../solrj/io/stream/StreamExpressionTest.java   | 49 ++++++++++++++++++++
 2 files changed, 51 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4d15b9fa/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c92d5ac..adda124 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -228,6 +228,8 @@ Other Changes
 
 * SOLR-8184: Negative tests for JDBC Connection String (Susheel Kumar, Jason Gerlowski, Kevin
Risden)
 
+* SOLR-8458: Add Streaming Expressions tests for parameter substitution (Joel Bernstein,
Cao Manh Dat, Dennis Gove, Kevin Risden)
+
 ==================  6.0.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4d15b9fa/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
index 4d8e616..1f1a5bf 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
@@ -178,6 +178,55 @@ public class StreamExpressionTest extends SolrCloudTestCase {
   }
 
   @Test
+  public void testParameterSubstitution() throws Exception {
+
+    new UpdateRequest()
+        .add(id, "0", "a_s", "hello0", "a_i", "0", "a_f", "0")
+        .add(id, "2", "a_s", "hello2", "a_i", "2", "a_f", "0")
+        .add(id, "3", "a_s", "hello3", "a_i", "3", "a_f", "3")
+        .add(id, "4", "a_s", "hello4", "a_i", "4", "a_f", "4")
+        .add(id, "1", "a_s", "hello1", "a_i", "1", "a_f", "1")
+        .commit(cluster.getSolrClient(), COLLECTION);
+
+    String url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/" + COLLECTION;
+    List<Tuple> tuples;
+    TupleStream stream;
+
+    // Basic test
+    Map<String,String> params = new HashMap<>();
+    params.put("expr","merge("
+        + "${q1},"
+        + "${q2},"
+        + "on=${mySort})");
+    params.put(CommonParams.QT, "/stream");
+    params.put("q1", "search(" + COLLECTION + ", q=\"id:(0 3 4)\", fl=\"id,a_s,a_i,a_f\",
sort=${mySort})");
+    params.put("q2", "search(" + COLLECTION + ", q=\"id:(1)\", fl=\"id,a_s,a_i,a_f\", sort=${mySort})");
+    params.put("mySort", "a_f asc");
+    stream = new SolrStream(url, params);
+    tuples = getTuples(stream);
+
+    assertEquals(4, tuples.size());
+    assertOrder(tuples, 0,1,3,4);
+
+    // Basic test desc
+    params.put("mySort", "a_f desc");
+    stream = new SolrStream(url, params);
+    tuples = getTuples(stream);
+
+    assertEquals(4, tuples.size());
+    assertOrder(tuples, 4,3,1,0);
+
+    // Basic w/ multi comp
+    params.put("q2", "search(" + COLLECTION + ", q=\"id:(1 2)\", fl=\"id,a_s,a_i,a_f\", sort=${mySort})");
+    params.put("mySort", "\"a_f asc, a_s asc\"");
+    stream = new SolrStream(url, params);
+    tuples = getTuples(stream);
+
+    assertEquals(5, tuples.size());
+    assertOrder(tuples, 0,2,1,3,4);
+  }
+
+  @Test
   public void testUniqueStream() throws Exception {
 
     new UpdateRequest()


Mime
View raw message