Apache Lucene open-source search software
SOLR-1697 PluginInfo should load plugins w/o class attribute also
Noble Paulca76f3b50c78
diff --git a/CHANGES.txt b/CHANGES.txtindex ccada284a14..2dd278b2f9a 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -77,7 +77,9 @@ New Features* SOLR-1131: FieldTypes can now output multiple Fields per Type and still be searched. This can be handy for hiding the details of a particularimplementation such as in the spatial case. (Chris Mattmann, shalin, noble, gsingers, yonik)-* SOLR-1586: Add support for Geohash and Spatial Tile FieldType (Chris Mattmann, gsingers)+* SOLR-1586: Add support for Geohash and Spatial Tile FieldType (Chris Mattmann, gsingers)++* SOLR-1697: PluginInfo should load plugins w/o class attribute also (noble)Optimizations----------------------diff --git a/src/java/org/apache/solr/core/PluginInfo.java b/src/java/org/apache/solr/core/PluginInfo.javaindex 87e18978377..0bb6c59b1b0 100644--- a/src/java/org/apache/solr/core/PluginInfo.java+++ b/src/java/org/apache/solr/core/PluginInfo.java@@ -57,19 +57,17 @@ public class PluginInfo {}private List<PluginInfo> loadSubPlugins(Node node) {- List<PluginInfo> children = null;- try {- //if there is another sub tag with a 'class' attribute that has to be another plugin- NodeList nodes = (NodeList) Config.xpathFactory.newXPath().evaluate("*[@class]",node, XPathConstants.NODESET);- if(nodes.getLength() > 0){- children = new ArrayList<PluginInfo>(nodes.getLength());- for (int i=0; i<nodes.getLength(); i++) {- PluginInfo pluginInfo = new PluginInfo(nodes.item(i), null, false, false);- if (pluginInfo.isEnabled()) children.add(pluginInfo);- }- }- } catch (XPathExpressionException e) { }- return children == null ? Collections.<PluginInfo>emptyList(): unmodifiableList(children);+ List<PluginInfo> children = new ArrayList<PluginInfo>();+ //if there is another sub tag with a non namedlist tag that has to be another plugin+ NodeList nlst = node.getChildNodes();+ for (int i = 0; i < nlst.getLength(); i++) {+ Node nd = nlst.item(i);+ if (nd.getNodeType() != Node.ELEMENT_NODE) continue;+ if (NL_TAGS.contains(nd.getNodeName())) continue;+ PluginInfo pluginInfo = new PluginInfo(nd, null, false, false);+ if (pluginInfo.isEnabled()) children.add(pluginInfo);+ }+ return children.isEmpty() ? Collections.<PluginInfo>emptyList() : unmodifiableList(children);}@Override@@ -102,4 +100,5 @@ public class PluginInfo {for (PluginInfo child : children) if(type.equals(child.type)) result.add(child);return result;}+ private static final HashSet<String> NL_TAGS = new HashSet<String>(Arrays.asList("lst","str","int","bool","arr","float","double"));}