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 37512dad48
commit 537862d5bb
2 changed files with 23 additions and 11 deletions

View File

@ -61,6 +61,19 @@ import org.slf4j.LoggerFactory;
import static org.apache.solr.common.params.CommonParams.ID; 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 * @since 5.1.0
*/ */
public class StreamHandler extends RequestHandlerBase implements SolrCoreAware, PermissionNameProvider { public class StreamHandler extends RequestHandlerBase implements SolrCoreAware, PermissionNameProvider {
@ -83,17 +96,6 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
} }
public void inform(SolrCore core) { 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 defaultCollection;
String defaultZkhost; String defaultZkhost;
CoreContainer coreContainer = core.getCoreContainer(); CoreContainer coreContainer = core.getCoreContainer();

View File

@ -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 `&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. 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 == Types of Streaming Expressions
=== About Stream Sources === About Stream Sources