Search in sources :

Example 16 with Explanation

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

the class StreamExpressionToExplanationTest method testRankStream.

@Test
public void testRankStream() throws Exception {
    RankStream stream;
    String expressionString;
    // Basic test
    stream = new RankStream(StreamExpressionParser.parse("top(" + "n=3," + "search(collection1, q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc,a_i asc\")," + "sort=\"a_f asc, a_i asc\")"), factory);
    Explanation explanation = stream.toExplanation(factory);
    Assert.assertEquals("top", explanation.getFunctionName());
    Assert.assertEquals(RankStream.class.getName(), explanation.getImplementingClass());
    Assert.assertEquals(1, ((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 17 with Explanation

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

the class CartesianProductStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    Explanation explanation = new StreamExplanation(getStreamNodeId().toString()).withChildren(new Explanation[] { stream.toExplanation(factory) }).withFunctionName(factory.getFunctionName(this.getClass())).withImplementingClass(this.getClass().getName()).withExpressionType(ExpressionType.STREAM_DECORATOR).withExpression(toExpression(factory, false).toString());
    for (NamedEvaluator evaluator : evaluators) {
        explanation.addHelper(evaluator.getEvaluator().toExplanation(factory));
    }
    explanation.addHelper(orderBy.toExplanation(factory));
    return explanation;
}
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)

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