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_r368076257
########## 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: > Since this code is duplicated between Stream & Graph, can we factor it out into a common method? Attached SOLR-13965.01.patch to the JIRA ticket. ---------------------------------------------------------------- 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