Skip to content

Apache Lucene open-source search software

Document how to load your own streaming plugins (#1025)

Eric Pugh537862d5bb42
diff --git a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
index d0dcc0ec93d..e9d81c04ff6 100644
--- a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
@@ -61,6 +61,19 @@ import org.slf4j.LoggerFactory;
import static org.apache.solr.common.params.CommonParams.ID;
/**
+ * <p>
+ * Solr Request Handler for streaming data.
+ * </p>
+ * <p>
+ * It loads a default set of mappings via {@link org.apache.solr.handler.SolrDefaultStreamFactory}.
+ * </p>
+ * <p>
+ * To add additional mappings, just define them as plugins in solrconfig.xml via
+ * {@code
+ * &lt;expressible name="count" class="org.apache.solr.client.solrj.io.stream.RecordCountStream" /&gt;
+ * }
+ * </p>
+ *
* @since 5.1.0
*/
public class StreamHandler extends RequestHandlerBase implements SolrCoreAware, PermissionNameProvider {
@@ -83,17 +96,6 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
}
public void inform(SolrCore core) {
-
- /*
- * The stream factory will always contain the zkUrl for the given collection Adds default streams with their
- * corresponding function names. These defaults can be overridden or added to in the solrConfig in the stream
- * RequestHandler def. Example config override
- * <lst name="streamFunctions">
- * <str name="group">org.apache.solr.client.solrj.io.stream.ReducerStream</str>
- * <str name="count">org.apache.solr.client.solrj.io.stream.RecordCountStream</str>
- * </lst>
- */
-
String defaultCollection;
String defaultZkhost;
CoreContainer coreContainer = core.getCoreContainer();
diff --git a/solr/solr-ref-guide/src/streaming-expressions.adoc b/solr/solr-ref-guide/src/streaming-expressions.adoc
index 3bd467cc680..7507b12dcec 100644
--- a/solr/solr-ref-guide/src/streaming-expressions.adoc
+++ b/solr/solr-ref-guide/src/streaming-expressions.adoc
@@ -123,6 +123,16 @@ for the entire expression, it may be faster for the client to send the expressio
`&streamLocalOnly=true` and handle merging of the results (if required) locally. This is an advanced option, relying
on a convenient organization of the index, and should only be considered if normal usage poses a performance issue.
+=== Adding Custom Expressions
+
+Creating your own custom expressions can be easily done by implementing the {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/io/stream/expr/Expressible.html[Expressible] interface. To add a custom expression to the
+list of known mappings for the `/stream` handler, you just need to declare it as a plugin in `solrconfig.xml` via:
+
+[source,xml]
+<expressible name="custom" class="org.example.CustomStreamingExpression"/>
+
+
+
== Types of Streaming Expressions
=== About Stream Sources