带有引号和多个逗号的CSV文件的Solr模式/索引

时间:2018-10-18 15:21:33

标签: search solr lucene

在这里请新手。我已经完成了许多在线教程,现在正在上传自己的数据。我在索引数据时遇到麻烦。我正在使用Solr 7.5。

这里是数据的子集。我所有的数据都存储在CSV文件中:

global_sentence_id,document_id,sentence_id,sentence,span 0,0,0,All right Jim .,"(0, 14)" 1,0,1,Your quarterlies look very good .,"(15, 47)" 2,0,2,How are things at the library ?,"(48, 78)" 3,1,0,"Oh , I told you .","(0, 15)" 4,1,1,I could n't close it .,"(16, 36)" 5,1,2,So ...,"(37, 42)" 6,2,0,So you 've come to the master for guidance ?,"(0, 42)" 7,2,1,"Is this what you 're saying , grasshopper ?","(43, 83)" 8,3,0,"Actually , you called me in here , but yeah .","(0, 42)" 9,4,0,All right .,"(0, 10)" 10,4,1,"Well , let me show you how it 's done .","(11, 47)"

您会看到它是5个字段。我将主要搜索“句子”字段。该字段将包含各种标点符号,多个句子,逗号,有些带有引号,而有些则没有。现在,如果一个句子带有额外的标点符号(例如逗号),那么该句子将用引号引起来,以避免在错误的分隔符上进行分割(第3、7、8和10行)。

这是我添加到托管模式文件中的字段:

<field name="global_sentence_id" type="string" indexed="true" required="true" stored="true"/> <field name="document_id" type="pint" indexed="true" stored="true"/> <field name="sentence_id" type="pint" indexed="false" stored="true"/> <field name="sentence" type="text_general" indexed="true" stored="true" multiValued="true"/> <field name="span" type="text_general" indexed="false" stored="true" multiValued="true"/>

要上传数据,请使用以下命令:

bin/post -c office2 server/solr/office2/tokenized_sentence_corpus.csv

但不指定任何参数。

现在,当我上传数据时,我得到:

SimplePostTool: WARNING: Solr returned an error #500 (Server Error) for url: http://localhost:8983/solr/office2/update SimplePostTool: WARNING: Response: { "responseHeader":{ "status":500, "QTime":42}, "error":{ "msg":"(line 0) invalid char between encapsulated token end delimiter",

之后是一条很长的跟踪消息。

我很困惑,因为我能够将所有数据复制并粘贴到Solr Admin UI的“文档”选项卡中,并且可以上传所有内容,并且可以运行搜索。我想知道是否需要指定任何参数,是否需要指定。 不幸的是,我正准备在VM上运行它,因此UI上传文档功能将无用。

任何帮助将不胜感激!

0 个答案:

没有答案
相关问题