The CSV loader incorrectly threw an exception when given header=true

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@600419 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2007-12-03 02:05:30 +00:00
parent c3f80c5004
commit b627573cba
3 changed files with 9 additions and 1 deletions

View File

@ -217,6 +217,10 @@ Bug Fixes
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

View File

@ -240,7 +240,7 @@ abstract class CSVLoader {
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 {

View File

@ -123,6 +123,10 @@ public class TestCSVLoader extends AbstractSolrTestCase {
loadLocal("stream.file",filename, "commit","true");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
// test explicitly adding header=true (the default)
loadLocal("stream.file",filename, "commit","true","header","true");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
// test no overwrites
loadLocal("stream.file",filename, "commit","true", "overwrite","false");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='8']");