From e2284bbedc1f9550bda2ce7e37d93da45ac4c9f6 Mon Sep 17 00:00:00 2001 From: Joel Bernstein Date: Wed, 24 May 2017 07:58:35 -0400 Subject: [PATCH] SOLR-10731: Add tests for params --- .../solrj/io/stream/StreamExpressionTest.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) 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 dc3a380cd0c..f76ed316ad7 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 @@ -920,7 +920,6 @@ public class StreamExpressionTest extends SolrCloudTestCase { } } - @Test public void testKnnStream() throws Exception { @@ -941,7 +940,26 @@ public class StreamExpressionTest extends SolrCloudTestCase { SolrStream solrStream = new SolrStream(jetty.getBaseUrl().toString() + "/collection1", sParams); List tuples = getTuples(solrStream); assertTrue(tuples.size() == 3); - assertOrder(tuples,2,3,4); + assertOrder(tuples, 2, 3, 4); + + sParams = new ModifiableSolrParams(StreamingTest.mapParams(CommonParams.QT, "/stream")); + sParams.add("expr", "knn(" + COLLECTIONORALIAS + ", id=\"1\", qf=\"a_t\", rows=\"4\", fl=\"id, score\", mintf=\"1\", maxdf=\"0\")"); + solrStream = new SolrStream(jetty.getBaseUrl().toString() + "/collection1", sParams); + tuples = getTuples(solrStream); + assertTrue(tuples.size() == 0); + + sParams = new ModifiableSolrParams(StreamingTest.mapParams(CommonParams.QT, "/stream")); + sParams.add("expr", "knn(" + COLLECTIONORALIAS + ", id=\"1\", qf=\"a_t\", rows=\"4\", fl=\"id, score\", mintf=\"1\", maxwl=\"1\")"); + solrStream = new SolrStream(jetty.getBaseUrl().toString() + "/collection1", sParams); + tuples = getTuples(solrStream); + assertTrue(tuples.size() == 0); + + sParams = new ModifiableSolrParams(StreamingTest.mapParams(CommonParams.QT, "/stream")); + sParams.add("expr", "knn(" + COLLECTIONORALIAS + ", id=\"1\", qf=\"a_t\", rows=\"2\", fl=\"id, score\", mintf=\"1\", minwl=\"20\")"); + solrStream = new SolrStream(jetty.getBaseUrl().toString() + "/collection1", sParams); + tuples = getTuples(solrStream); + assertTrue(tuples.size() == 0); + } finally { cache.close(); }