madrob 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_r362626064
########## 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)); Review comment: This line is likely hiding a bug (and also a bug in StreamHandler) because `SolrConfig.classVsSolrPluginInfo.get(Expressible.class)` should always return null due to type mismatch on the map. Need a String key, but we also don't have any tests to prove this out. If you don't want to address that in this issue, feel free to file a new JIRA and tag me on it. :) ---------------------------------------------------------------- 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