SOLR-13947: Document how to load your own streaming plugins (#1025)

This commit is contained in:
Eric Pugh 2019-11-22 14:16:57 -05:00 committed by Tomas Fernandez Lobbe
parent 65888d0542
commit 4b37fb0c8f
2 changed files with 21 additions and 11 deletions

View File

@ -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();

View File

@ -114,6 +114,14 @@ unless the jvm has been started with `-DStreamingExpressionMacros=true` (usually
Because streaming expressions relies on the `/export` handler, many of the field and field type requirements to use `/export` are also requirements for `/stream`, particularly for `sort` and `fl` parameters. Please see the section <<exporting-result-sets.adoc#exporting-result-sets,Exporting Result Sets>> for details.
=== 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