epugh commented on a change in pull request #1033: SOLR-13965: Use Plugin to 
add new expressions to GraphHandler
URL: https://github.com/apache/lucene-solr/pull/1033#discussion_r362241759
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/handler/GraphHandler.java
 ##########
 @@ -92,24 +104,29 @@ public void inform(SolrCore core) {
     }
 
     // This pulls all the overrides and additions from the config
+    List<PluginInfo> pluginInfos = 
core.getSolrConfig().getPluginInfos(Expressible.class.getName());
+
+    // 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();
         PluginInfo pluginInfo = new PluginInfo(key, 
Collections.singletonMap("class", functionMapping.getValue()));
-
-        if (pluginInfo.pkgName == null) {
-          Class<? extends Expressible> clazz = 
core.getResourceLoader().findClass((String) functionMapping.getValue(),
-              Expressible.class);
-          streamFactory.withFunctionName(key, clazz);
-        } else {
-          StreamHandler.ExpressibleHolder holder = new 
StreamHandler.ExpressibleHolder(pluginInfo, core, 
SolrConfig.classVsSolrPluginInfo.get(Expressible.class));
-          streamFactory.withFunctionName(key, () -> holder.getClazz());
-        }
-
+        pluginInfos.add(pluginInfo);
       }
+    }
 
+    for (PluginInfo pluginInfo : pluginInfos) {
+      if (pluginInfo.pkgName != null) {
+        ExpressibleHolder holder = new ExpressibleHolder(pluginInfo, core, 
SolrConfig.classVsSolrPluginInfo.get(Expressible.class));
+        streamFactory.withFunctionName(pluginInfo.name,
+            () -> holder.getClazz());
+      } else {
+        Class<? extends Expressible> clazz = 
core.getMemClassLoader().findClass(pluginInfo.className, Expressible.class);
 
 Review comment:
   I'll be honest @cpoerschke I am mostly copying what is in StreamHandler, as 
this includes the new plugin framework support.   StreamHandler uses the 
`core.getMemClassLoader`, which when I click into seems to be all about plugins 
;-).   My whole goal in this PR was to get StreamHandler and GraphHandler to be 
much more similar in how they work.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to