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());
}
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;
}
Aggregations