[GitHub] [lucene-solr] epugh commented on a change in pull request #1033: SOLR-13965: Use Plugin to add new expressions to GraphHandler

2020-01-02 Thread GitBox
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_r362638584
 
 

 ##
 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 pluginInfos = 
core.getSolrConfig().getPluginInfos(Expressible.class.getName());
+
+// Check deprecated approach.
 Object functionMappingsObj = initArgs.get("streamFunctions");
 if(null != functionMappingsObj){
+  log.warn("solrconfig.xml:  is deprecated for adding 
additional streaming functions to GraphHandler.");
   NamedList functionMappings = (NamedList)functionMappingsObj;
   for(Entry functionMapping : functionMappings) {
 String key = functionMapping.getKey();
 PluginInfo pluginInfo = new PluginInfo(key, 
Collections.singletonMap("class", functionMapping.getValue()));
-
-if (pluginInfo.pkgName == null) {
-  Class 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:
   @madrob can you push up a fix to this PR?   


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



[GitHub] [lucene-solr] epugh commented on a change in pull request #1033: SOLR-13965: Use Plugin to add new expressions to GraphHandler

2019-12-31 Thread GitBox
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 pluginInfos = 
core.getSolrConfig().getPluginInfos(Expressible.class.getName());
+
+// Check deprecated approach.
 Object functionMappingsObj = initArgs.get("streamFunctions");
 if(null != functionMappingsObj){
+  log.warn("solrconfig.xml:  is deprecated for adding 
additional streaming functions to GraphHandler.");
   NamedList functionMappings = (NamedList)functionMappingsObj;
   for(Entry functionMapping : functionMappings) {
 String key = functionMapping.getKey();
 PluginInfo pluginInfo = new PluginInfo(key, 
Collections.singletonMap("class", functionMapping.getValue()));
-
-if (pluginInfo.pkgName == null) {
-  Class 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 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



[GitHub] [lucene-solr] epugh commented on a change in pull request #1033: SOLR-13965: Use Plugin to add new expressions to GraphHandler

2019-12-11 Thread GitBox
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_r356693666
 
 

 ##
 File path: solr/core/src/java/org/apache/solr/handler/GraphHandler.java
 ##
 @@ -87,14 +88,10 @@ public void inform(SolrCore core) {
 }
 
 // This pulls all the overrides and additions from the config
-Object functionMappingsObj = initArgs.get("streamFunctions");
 
 Review comment:
   @cpoerschke I am pushing up a fix to do the deprecations...


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



[GitHub] [lucene-solr] epugh commented on a change in pull request #1033: SOLR-13965: Use Plugin to add new expressions to GraphHandler

2019-12-11 Thread GitBox
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_r356635101
 
 

 ##
 File path: solr/core/src/java/org/apache/solr/handler/GraphHandler.java
 ##
 @@ -87,14 +88,10 @@ public void inform(SolrCore core) {
 }
 
 // This pulls all the overrides and additions from the config
-Object functionMappingsObj = initArgs.get("streamFunctions");
 
 Review comment:
   I wondered the same thing.   I don't think anyone actually customizes this 
handler, but that is just a guess.   I can add a deprecated warning, do you 
have a good example that I could copy of how we normally do that?  


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