cpoerschke 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_r362065317
 
 

 ##########
 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:
   Thanks @epugh for resolving the merge conflicts! The previous 
`getResourceLoader` is now replaced with `getMemClassLoader` here, just 
checking if that's intended or accidental perhaps, not yet looked what the 
difference (if any) between the two methods' behaviour is.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to