Search in sources :

Example 1 with ID

use of org.apache.solr.common.params.CommonParams.ID in project lucene-solr by apache.

the class TopicStream 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 1 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 mParams = new ModifiableSolrParams(params);
        child.setExpression(mParams.getMap().entrySet().stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), e.getValue())).collect(Collectors.joining(",")));
        explanation.addChild(child);
    }
    {
        // child 2 is a place where we store and read checkpoint info from
        StreamExplanation child = new StreamExplanation(getStreamNodeId() + "-checkpoint");
        child.setFunctionName(String.format(Locale.ROOT, "solr (checkpoint store)"));
        child.setImplementingClass("Solr/Lucene");
        child.setExpressionType(ExpressionType.DATASTORE);
        child.setExpression(String.format(Locale.ROOT, "id=%s, collection=%s, checkpointEvery=%d", id, checkpointCollection, checkpointEvery));
        explanation.addChild(child);
    }
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) VERSION_FIELD(org.apache.solr.common.params.CommonParams.VERSION_FIELD) StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) Tuple(org.apache.solr.client.solrj.io.Tuple) ClusterState(org.apache.solr.common.cloud.ClusterState) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) Random(java.util.Random) StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) TreeSet(java.util.TreeSet) SolrParams(org.apache.solr.common.params.SolrParams) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) StreamFactory(org.apache.solr.client.solrj.io.stream.expr.StreamFactory) Builder(org.apache.solr.client.solrj.impl.CloudSolrClient.Builder) ZkCoreNodeProps(org.apache.solr.common.cloud.ZkCoreNodeProps) Locale(java.util.Locale) Map(java.util.Map) Expressible(org.apache.solr.client.solrj.io.stream.expr.Expressible) FieldComparator(org.apache.solr.client.solrj.io.comp.FieldComparator) ExecutorUtil(org.apache.solr.common.util.ExecutorUtil) ExecutorService(java.util.concurrent.ExecutorService) StreamExpressionNamedParameter(org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter) SORT(org.apache.solr.common.params.CommonParams.SORT) ZkStateReader(org.apache.solr.common.cloud.ZkStateReader) Slice(org.apache.solr.common.cloud.Slice) Logger(org.slf4j.Logger) ComparatorOrder(org.apache.solr.client.solrj.io.comp.ComparatorOrder) ExpressionType(org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams) MethodHandles(java.lang.invoke.MethodHandles) Collection(java.util.Collection) Set(java.util.Set) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) Explanation(org.apache.solr.client.solrj.io.stream.expr.Explanation) Replica(org.apache.solr.common.cloud.Replica) StreamExpressionValue(org.apache.solr.client.solrj.io.stream.expr.StreamExpressionValue) SolrDocument(org.apache.solr.common.SolrDocument) List(java.util.List) HttpSolrClient(org.apache.solr.client.solrj.impl.HttpSolrClient) DISTRIB(org.apache.solr.common.params.CommonParams.DISTRIB) UpdateRequest(org.apache.solr.client.solrj.request.UpdateRequest) ID(org.apache.solr.common.params.CommonParams.ID) Entry(java.util.Map.Entry) SolrjNamedThreadFactory(org.apache.solr.common.util.SolrjNamedThreadFactory) Collections(java.util.Collections) SolrInputDocument(org.apache.solr.common.SolrInputDocument) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams)

Aggregations

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 Builder (org.apache.solr.client.solrj.impl.CloudSolrClient.Builder)1 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)1 Tuple (org.apache.solr.client.solrj.io.Tuple)1 ComparatorOrder (org.apache.solr.client.solrj.io.comp.ComparatorOrder)1