lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r787139 - in /lucene/solr/trunk/contrib/dataimporthandler: CHANGES.txt src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
Date Mon, 22 Jun 2009 04:39:58 GMT
Author: noble
Date: Mon Jun 22 04:39:58 2009
New Revision: 787139

URL: http://svn.apache.org/viewvc?rev=787139&view=rev
Log:
SOLR-1235 disallow period (.) in entity names

Modified:
    lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java

Modified: lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt?rev=787139&r1=787138&r2=787139&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt (original)
+++ lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt Mon Jun 22 04:39:58 2009
@@ -147,6 +147,8 @@
 
 34.SOLR-1230: Enhanced dataimport.jsp to work with all DataImportHandler request handler
configurations,
               rather than just a hardcoded /dataimport handler. (ehatcher)
+              
+35.SOLR-1235: disallow period (.) in entity names (noble)
 
 Optimizations
 ----------------------

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java?rev=787139&r1=787138&r2=787139&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
Mon Jun 22 04:39:58 2009
@@ -21,6 +21,7 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.apache.solr.schema.SchemaField;
+import static org.apache.solr.handler.dataimport.DataImportHandlerException.SEVERE;
 
 import java.util.*;
 
@@ -111,8 +112,14 @@
 
     public Entity(Element element) {
       name = getStringAttribute(element, NAME, null);
+      if(name == null){
+        throw new DataImportHandlerException(SEVERE, "Entity must have name '" );
+      }
+      if(name.indexOf(".") != -1){
+        throw new DataImportHandlerException(SEVERE, "Entity name must not have period (.):
'" + name);
+      }      
       if (RESERVED_WORDS.contains(name)) {
-        throw new DataImportHandlerException(DataImportHandlerException.SEVERE, "Entity name
: '" + name
+        throw new DataImportHandlerException(SEVERE, "Entity name : '" + name
                 + "' is a reserved keyword. Reserved words are: " + RESERVED_WORDS);
       }
       pk = getStringAttribute(element, "pk", null);
@@ -208,7 +215,7 @@
       this.name = getStringAttribute(e, DataImporter.NAME, null);
       this.column = getStringAttribute(e, DataImporter.COLUMN, null);
       if (column == null) {
-        throw new DataImportHandlerException(DataImportHandlerException.SEVERE, "Field must
have a column attribute");
+        throw new DataImportHandlerException(SEVERE, "Field must have a column attribute");
       }
       this.boost = Float.parseFloat(getStringAttribute(e, "boost", "1.0f"));
       allAttributes.putAll(getAllAttributes(e));
@@ -225,7 +232,7 @@
   public void readFromXml(Element e) {
     List<Element> n = getChildNodes(e, "document");
     if (n.isEmpty()) {
-      throw new DataImportHandlerException(DataImportHandlerException.SEVERE, "DataImportHandler
" +
+      throw new DataImportHandlerException(SEVERE, "DataImportHandler " +
               "configuration file must have one <document> node.");
     }
     document = new Document(n.get(0));
@@ -243,7 +250,7 @@
         String clz = getStringAttribute(element, CLASS, null);
         if (func == null || clz == null){
           throw new DataImportHandlerException(
-                  DataImportHandlerException.SEVERE,
+                  SEVERE,
                   "<function> must have a 'name' and 'class' attributes");
         } else {
           functions.add(getAllAttributes(element));
@@ -317,10 +324,6 @@
 
   public static final String NAME = "name";
 
-  public static final String SCRIPT_LANG = "scriptlanguage";
-
-  public static final String SCRIPT_NAME = "scriptname";
-
   public static final String PROCESSOR = "processor";
 
   /**
@@ -347,6 +350,7 @@
     RESERVED_WORDS.add("delta");
     RESERVED_WORDS.add("functions");
     RESERVED_WORDS.add("session");
+    RESERVED_WORDS.add(SolrWriter.LAST_INDEX_KEY);
   }
 
 }



Mime
View raw message