在solr中索引csv文件时获取错误

时间:2014-06-23 07:10:55

标签: solr lucene

我在doc文件中有一个名为data.csv的文件。 索引csv文件时,我得到以下错误:

docs] $ curl "http://localhost:8983/solr/update/csv?commit=true" --data-binary @data.csv -H 'Content-type:text/plain; charset=utf-8'<?xml version="1.0" encoding="UTF-8"?>

<response>

<lst name="responseHeader"><int name="status">415</int><int name="QTime">0</int></lst><lst name="error"><str name="msg">Unsupported ContentType: text/plain  Not in: [application/xml, text/csv, text/json, application/csv, application/javabin, text/xml, application/json]</str><int name="code">415</int></lst>

</response>

任何人都可以帮助我吗

1 个答案:

答案 0 :(得分:0)

您是否尝试将内容类型标头设置为text / csv?因为错误信息在其描述中非常清楚

编辑:

CSVRequestHandler的init方法如下所示:

  public void init(NamedList args) {
    super.init(args);
    setAssumeContentType("application/csv");
    // log.warn("Using deprecated class: "+this.getClass().getSimpleName()+" -- replace with UpdateRequestHandler");
  }

我猜application/csv可以在所有

之后起作用