apache Solr从csv(UTF-8)导入索引错误:未定义字段 [英] Apach Solr import index from csv(UTF-8) error: undefined field
问题描述
当我尝试使用solr文档中的命令加载数据时:
When I try to load data using command from solr documentation:
curl http://localhost:7070/solr/metadataCore/update?commit=true --data-binary @7.csv -H 'Content-type:text/csv; charset=utf-8'
结果:
1)如果csv编码为ANSI,则可以成功导入/更新,但不支持中文.
1)If the csv encode is ANSI, it can import/update successfully but it can not support Chinese.
2)如果csv编码为UTF-8,则结果为错误,但始终显示:undefined字段.
2)if the csv encode is UTF-8, result is error but it always show :undefined field.
csv中的第一列是topicType.但是,该字段已明确定义,并且该字段是什么?字段名称之前?如何加载数据?
The first column in csv is topicType. However the field is clearly defined and what is it with the ? before the field name? How can I load the data?
推荐答案
很可能您遇到了字节顺序标记,某些软件(尤其是Microsoft)放在文本的开头.
Most probably you run into the Byte Order Mark that some software (especially Microsoft) put right at the start of the text.
您应该能够搜索没有字节顺序标记的'您的软件'导出",并且会找到答案或解决方法.有些编辑者可能还知道如何保存有无BOM
You should be able to search for "'your software' export without byte order mark" and you'll find an answer or a workaround. Some editors may also know how to save with or without BOM
这篇关于apache Solr从csv(UTF-8)导入索引错误:未定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!