为什么可以';t以故障保护方式将csv文件插入SOLR

为什么可以';t以故障保护方式将csv文件插入SOLR,csv,curl,solr,Csv,Curl,Solr,当csv中有一行没有正确的字段时,solr不会插入整个文档。是否有任何方法可以告诉solr ok跳过该行,保留前几行,并递归地在无效行之后继续下一行 样品 C:\dev\tools\solr-4.7.2\apache-tomcat-6.0.37\bin>curl "http://localhost:8080/solr-4.7.2/update/csv?commit=true&rowid=id&fieldnames=interfaceSeq_s,extractId_s,cou

当csv中有一行没有正确的字段时,solr不会插入整个文档。是否有任何方法可以告诉solr ok跳过该行,保留前几行,并递归地在无效行之后继续下一行

样品

C:\dev\tools\solr-4.7.2\apache-tomcat-6.0.37\bin>curl "http://localhost:8080/solr-4.7.2/update/csv?commit=true&rowid=id&fieldnames=interfaceSeq_s,extractId_s,country_s,invoiceNumber_s,ori
ginalLineId_s,keyValue_s,levelNumber_s,description_s,chargeGroup_s,chargeSubGroup_s,charge_s,startDateTime_s,endDateTime_s,totalValue_s,billedValue_s,discountValue_s,inclusiveValue_s,unit
OfMeasure_s,attribute1_s,attribute2_s,attribute3_s,attribute4_s,attribute5_s,attribute6_s,attribute7_s,attribute8_s,totalUnits_s,inclusiveUnits_s,billedUnits_s,attribute11_s&skipLines=0&s
eparator=%09&stream.file=C:\opt\invoices\input\5924usage_data1.dat&stream.contentType=text/csv&header=false&trim=true&rowidOffset=123758&literal.recordtype_s=usagedata&literal.filename_s=
5924usage_data1.dat"
回应

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">24</int></lst><lst name="error"><str name="msg">CSVLoader: input=file:/C:/opt/invoices/input/5924usage_data1.dat,
line=2,expected 30 values but got 1
        values={'10000000003',}</str><int name="code">400</int></lst>
</response>

我找到了答案。如下面org.apache.solr.handler.loader.CSVLoaderBase中的代码所示,它不是默认CSV加载器中可配置的。我必须用我自己的CSVRRequestHander

    if (vals.length != fieldnames.length) {
      input_err("expected "+fieldnames.length+" values but got "+vals.length, vals, line);
    }
    if (vals.length != fieldnames.length) {
      input_err("expected "+fieldnames.length+" values but got "+vals.length, vals, line);
    }