Author: yonik
Date: Sun Dec  2 18:05:30 2007
New Revision: 600419

URL: http://svn.apache.org/viewvc?rev=600419&view=rev
Log:
The CSV loader incorrectly threw an exception when given header=true

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java
    lucene/solr/trunk/src/test/org/apache/solr/handler/TestCSVLoader.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=600419&r1=600418&r2=600419&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Sun Dec  2 18:05:30 2007
@@ -217,6 +217,10 @@
 13. SOLR-413: Requesting a large numbers of documents to be returned (limit)
     can result in an out-of-memory exception, even for a small index. (yonik)
 
+14. The CSV loader incorrectly threw an exception when given
+    header=true (the default).  (ryan, yonik)
+
+
 Other Changes
  1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
     build scripts to make two jars: apache-solr-1.3.jar and 

Modified: 
lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java
URL: 
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java?rev=600419&r1=600418&r2=600419&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java 
(original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java 
Sun Dec  2 18:05:30 2007
@@ -240,7 +240,7 @@
       if (null == hasHeader) {
         // assume the file has the headers if they aren't supplied in the args
         hasHeader=true;
-      } else if (hasHeader) {
+      } else if (!hasHeader) {
         throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"CSVLoader: must specify 
fieldnames=<fields>* or header=true");
       }
     } else {

Modified: lucene/solr/trunk/src/test/org/apache/solr/handler/TestCSVLoader.java
URL: 
http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/handler/TestCSVLoader.java?rev=600419&r1=600418&r2=600419&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/handler/TestCSVLoader.java 
(original)
+++ lucene/solr/trunk/src/test/org/apache/solr/handler/TestCSVLoader.java Sun 
Dec  2 18:05:30 2007
@@ -123,6 +123,10 @@
     loadLocal("stream.file",filename, "commit","true");
     assertQ(req("id:[100 TO 110]"),"//[EMAIL PROTECTED]'4']");
 
+    // test explicitly adding header=true (the default)
+    loadLocal("stream.file",filename, "commit","true","header","true");
+    assertQ(req("id:[100 TO 110]"),"//[EMAIL PROTECTED]'4']");
+
     // test no overwrites
     loadLocal("stream.file",filename, "commit","true", "overwrite","false");
     assertQ(req("id:[100 TO 110]"),"//[EMAIL PROTECTED]'8']");


Reply via email to