Search in sources :

Example 11 with StreamExplanation

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

the class FacetStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_SOURCE);
    explanation.setExpression(toExpression(factory).toString());
    // child is a datastore so add it at this point
    StreamExplanation child = new StreamExplanation(getStreamNodeId() + "-datastore");
    child.setFunctionName(String.format(Locale.ROOT, "solr (%s)", collection));
    // TODO: fix this so we know the # of workers - check with Joel about a Topic's ability to be in a
    // parallel stream.
    child.setImplementingClass("Solr/Lucene");
    child.setExpressionType(ExpressionType.DATASTORE);
    ModifiableSolrParams tmpParams = new ModifiableSolrParams(SolrParams.toMultiMap(params.toNamedList()));
    child.setExpression(tmpParams.getMap().entrySet().stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), e.getValue())).collect(Collectors.joining(",")));
    explanation.addChild(child);
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams)

Example 12 with StreamExplanation

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

the class GatherNodesStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.GRAPH_SOURCE);
    explanation.setExpression(toExpression(factory).toString());
    // one child is a stream
    explanation.addChild(tupleStream.toExplanation(factory));
    // one child is a datastore so add it at this point
    StreamExplanation child = new StreamExplanation(getStreamNodeId() + "-datastore");
    child.setFunctionName("solr (graph)");
    child.setImplementingClass("Solr/Lucene");
    child.setExpressionType(ExpressionType.DATASTORE);
    child.setExpression(queryParams.entrySet().stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), e.getValue())).collect(Collectors.joining(",")));
    explanation.addChild(child);
    if (null != metrics) {
        for (Metric metric : metrics) {
            explanation.addHelper(metric.toExplanation(factory));
        }
    }
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)

Example 13 with StreamExplanation

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

the class ShortestPathStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.GRAPH_SOURCE);
    explanation.setExpression(toExpression(factory).toString());
    // child is a datastore so add it at this point
    StreamExplanation child = new StreamExplanation(getStreamNodeId() + "-datastore");
    child.setFunctionName("solr (graph)");
    child.setImplementingClass("Solr/Lucene");
    child.setExpressionType(ExpressionType.DATASTORE);
    ModifiableSolrParams mParams = new ModifiableSolrParams(queryParams);
    child.setExpression(mParams.getMap().entrySet().stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), e.getValue())).collect(Collectors.joining(",")));
    explanation.addChild(child);
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams)

Example 14 with StreamExplanation

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

the class GetStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_SOURCE);
    explanation.setExpression(toExpression(factory, false).toString());
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)

Example 15 with StreamExplanation

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

the class CellStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_DECORATOR);
    explanation.setExpression(toExpression(factory, false).toString());
    explanation.addChild(stream.toExplanation(factory));
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)

Aggregations

StreamExplanation (org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)34 Explanation (org.apache.solr.client.solrj.io.stream.expr.Explanation)10 Test (org.junit.Test)8 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)7 StreamExpression (org.apache.solr.client.solrj.io.stream.expr.StreamExpression)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Tuple (org.apache.solr.client.solrj.io.Tuple)2 StreamFactory (org.apache.solr.client.solrj.io.stream.expr.StreamFactory)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 MethodHandles (java.lang.invoke.MethodHandles)1 SQLException (java.sql.SQLException)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 Entry (java.util.Map.Entry)1 Random (java.util.Random)1