Search in sources :

Example 11 with Explanation

use of org.apache.solr.client.solrj.io.stream.expr.Explanation in project lucene-solr by apache.

the class StreamExpressionToExplanationTest method testComplementStream.

@Test
public void testComplementStream() throws Exception {
    ComplementStream stream;
    String expressionString;
    // Basic test
    stream = new ComplementStream(StreamExpressionParser.parse("complement(" + "search(collection1, q=\"id:(0 3 4)\", fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_s asc\")," + "search(collection1, q=\"id:(1 2)\", fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_s asc\")," + "on=\"a_f, a_s\")"), factory);
    Explanation explanation = stream.toExplanation(factory);
    Assert.assertEquals("complement", explanation.getFunctionName());
    Assert.assertEquals(ComplementStream.class.getName(), explanation.getImplementingClass());
    Assert.assertEquals(2, ((StreamExplanation) explanation).getChildren().size());
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) Explanation(org.apache.solr.client.solrj.io.stream.expr.Explanation) Test(org.junit.Test)

Example 12 with Explanation

use of org.apache.solr.client.solrj.io.stream.expr.Explanation in project lucene-solr by apache.

the class StreamExpressionToExplanationTest method testTopicStream.

@Test
public void testTopicStream() throws Exception {
    TopicStream stream;
    // Basic test
    stream = new TopicStream(StreamExpressionParser.parse("topic(collection2, collection1, q=*:*, fl=\"id,a_s,a_i,a_f\", id=\"blah\", checkpointEvery=1000)"), factory);
    Explanation explanation = stream.toExplanation(factory);
    Assert.assertEquals("topic", explanation.getFunctionName());
    Assert.assertEquals(TopicStream.class.getName(), explanation.getImplementingClass());
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) Explanation(org.apache.solr.client.solrj.io.stream.expr.Explanation) Test(org.junit.Test)

Example 13 with Explanation

use of org.apache.solr.client.solrj.io.stream.expr.Explanation in project lucene-solr by apache.

the class StreamExpressionToExplanationTest method testDaemonStream.

@Test
public void testDaemonStream() throws Exception {
    DaemonStream stream;
    // Basic test
    stream = new DaemonStream(StreamExpressionParser.parse("daemon(search(collection1, q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_i asc\"), id=\"blah\", runInterval=\"1000\", queueSize=\"100\")"), factory);
    Explanation explanation = stream.toExplanation(factory);
    Assert.assertEquals("daemon", explanation.getFunctionName());
    Assert.assertEquals(DaemonStream.class.getName(), explanation.getImplementingClass());
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) Explanation(org.apache.solr.client.solrj.io.stream.expr.Explanation) Test(org.junit.Test)

Example 14 with Explanation

use of org.apache.solr.client.solrj.io.stream.expr.Explanation in project lucene-solr by apache.

the class StreamExpressionToExplanationTest method testMergeStream.

@Test
public void testMergeStream() throws Exception {
    MergeStream stream;
    // Basic test
    stream = new MergeStream(StreamExpressionParser.parse("merge(" + "search(collection1, q=\"id:(0 3 4)\", fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_s asc\")," + "search(collection1, q=\"id:(1 2)\", fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_s asc\")," + "on=\"a_f asc, a_s asc\")"), factory);
    Explanation explanation = stream.toExplanation(factory);
    Assert.assertEquals("merge", explanation.getFunctionName());
    Assert.assertEquals(MergeStream.class.getName(), explanation.getImplementingClass());
    Assert.assertEquals(2, ((StreamExplanation) explanation).getChildren().size());
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) Explanation(org.apache.solr.client.solrj.io.stream.expr.Explanation) Test(org.junit.Test)

Example 15 with Explanation

use of org.apache.solr.client.solrj.io.stream.expr.Explanation in project lucene-solr by apache.

the class StreamExpressionToExplanationTest method testStatsStream.

@Test
public void testStatsStream() throws Exception {
    StatsStream stream;
    // Basic test
    stream = new StatsStream(StreamExpressionParser.parse("stats(collection1, q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_i asc\", sum(a_i), avg(a_i), count(*), min(a_i), max(a_i))"), factory);
    Explanation explanation = stream.toExplanation(factory);
    Assert.assertEquals("stats", explanation.getFunctionName());
    Assert.assertEquals(StatsStream.class.getName(), explanation.getImplementingClass());
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) Explanation(org.apache.solr.client.solrj.io.stream.expr.Explanation) Test(org.junit.Test)

Aggregations

Explanation (org.apache.solr.client.solrj.io.stream.expr.Explanation)17 StreamExplanation (org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)16 Test (org.junit.Test)15 StreamExpression (org.apache.solr.client.solrj.io.stream.expr.StreamExpression)3 IOException (java.io.IOException)1 MethodHandles (java.lang.invoke.MethodHandles)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Random (java.util.Random)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 ExecutorService (java.util.concurrent.ExecutorService)1 Future (java.util.concurrent.Future)1 Collectors (java.util.stream.Collectors)1