lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r895909 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/core/PluginInfo.java
Date Tue, 05 Jan 2010 05:38:36 GMT
Author: noble
Date: Tue Jan  5 05:38:27 2010
New Revision: 895909

URL: http://svn.apache.org/viewvc?rev=895909&view=rev
Log:
SOLR-1697 PluginInfo should load plugins w/o class attribute also

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=895909&r1=895908&r2=895909&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Jan  5 05:38:27 2010
@@ -77,7 +77,9 @@
 * SOLR-1131: FieldTypes can now output multiple Fields per Type and still be searched.  This
can be handy for hiding the details of a particular
   implementation 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
 ----------------------

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java?rev=895909&r1=895908&r2=895909&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java Tue Jan  5 05:38:27 2010
@@ -57,19 +57,17 @@
   }
 
   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 @@
     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"));
 }



Mime
View raw message