You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/05/25 09:57:05 UTC

[GitHub] [lucene-solr] sigram commented on a change in pull request #1506: SOLR-14470: Add streaming expressions to /export handler

sigram commented on a change in pull request #1506:
URL: https://github.com/apache/lucene-solr/pull/1506#discussion_r429847378



##########
File path: solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
##########
@@ -216,14 +376,53 @@ public void write(OutputStream os) throws IOException {
       return;
     }
 
+    String expr = params.get(StreamParams.EXPR);
+    if (expr != null) {
+      StreamFactory streamFactory = initialStreamContext.getStreamFactory();
+      try {
+        StreamExpression expression = StreamExpressionParser.parse(expr);
+        if (streamFactory.isEvaluator(expression)) {
+          streamExpression = new StreamExpression(StreamParams.TUPLE);
+          streamExpression.addParameter(new StreamExpressionNamedParameter(StreamParams.RETURN_VALUE, expression));
+        } else {
+          streamExpression = expression;
+        }
+      } catch (Exception e) {
+        writeException(e, writer, true);
+        return;
+      }
+      streamContext = new StreamContext();
+      streamContext.setRequestParams(params);
+      // nocommit enforce this?
+      streamContext.setLocal(true);
+
+      streamContext.workerID = 0;
+      streamContext.numWorkers = 1;
+      streamContext.setSolrClientCache(initialStreamContext.getSolrClientCache());
+      streamContext.setModelCache(initialStreamContext.getModelCache());
+      streamContext.setObjectCache(initialStreamContext.getObjectCache());
+      streamContext.put("core", req.getCore().getName());

Review comment:
       It's consistent with other places that create StreamContext.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org