Apache Lucene open-source search software
SOLR-13965: In GraphHandler, support <expressible> configuration and deprecate <streamFunctions> configuration.
Eric Pughb4f3efbf94e2
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 26f46b966c6..26cbf9b20c5 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -62,6 +62,9 @@ New Features* SOLR-14241: New delete() Stream Decorator (hossman)+ * SOLR-13965: In GraphHandler, support <expressible> configuration and deprecate <streamFunctions> configuration.+ (Eric Pugh via Christine Poerschke)+Improvements---------------------* SOLR-14120: Define JavaScript methods 'includes' and 'startsWith' to ensure AdminUI can be displayed when usingdiff --git a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java b/solr/core/src/java/org/apache/solr/handler/GraphHandler.javaindex a50855dd212..bed4086f116 100644--- a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java@@ -54,6 +54,28 @@ import org.slf4j.LoggerFactory;/**+ * <p>+ * Solr Request Handler for graph traversal with streaming functions that responds with GraphML markup.+ * </p>+ * <p>+ * It loads the default set of streaming expression functions via {@link org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory}.+ * </p>+ * <p>+ * To add additional functions, just define them as plugins in solrconfig.xml via+ * {@code+ * <expressible name="count" class="org.apache.solr.client.solrj.io.stream.RecordCountStream" />+ * }+ * </p>+ * <p>+ * The @deprecated configuration method as of Solr 8.5 is+ * {@code+ * <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>+ * }+ *</p>+ ** @since 6.1.0*/public class GraphHandler extends RequestHandlerBase implements SolrCoreAware, PermissionNameProvider {@@ -68,17 +90,6 @@ public class GraphHandler extends RequestHandlerBase implements SolrCoreAware, P}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();@@ -92,8 +103,12 @@ public class GraphHandler extends RequestHandlerBase implements SolrCoreAware, P}// This pulls all the overrides and additions from the config+ StreamHandler.addExpressiblePlugins(streamFactory, core);++ // Check deprecated approach.Object functionMappingsObj = initArgs.get("streamFunctions");if(null != functionMappingsObj){+ log.warn("solrconfig.xml: <streamFunctions> is deprecated for adding additional streaming functions to GraphHandler.");NamedList<?> functionMappings = (NamedList<?>)functionMappingsObj;for(Entry<String,?> functionMapping : functionMappings) {String key = functionMapping.getKey();diff --git a/solr/solr-ref-guide/src/streaming-expressions.adoc b/solr/solr-ref-guide/src/streaming-expressions.adocindex 46639cb7fad..a49afca17fb 100644--- a/solr/solr-ref-guide/src/streaming-expressions.adoc+++ b/solr/solr-ref-guide/src/streaming-expressions.adoc@@ -135,10 +135,10 @@ The value of `shards.preference` that is used to route requests is determined in=== Adding Custom ExpressionsCreating 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:+list of known mappings for the `/stream` and `/graph` handlers, you just need to declare it as a plugin in `solrconfig.xml` via:[source,xml]-<expressible name="custom" class="org.example.CustomStreamingExpression"/>+<expressible name="custom" class="org.example.CustomStreamingExpression"/>== Types of Streaming Expressions