给出以下csv文件:
id,name,manu,cat,features,price,popularity,inStock,manufacturedate_dt,store
SPF15,Hawaii Sunblock,P&G,lotion|medicine|ointment,15SPF|waterproof|kidsfriendly,8.99,8,true,2011-02-13T15:26:37Z,"35.0752,-97.032"
当我运行此命令时
curl 'http://localhost:8080/solr/update/csv?commit=true&f.features.split=true&f.features.separator=%7Cf.cat.split=true&f.cat.separator=%7C' --data-binary @input.csv -H 'Content-type:text/plain; charset=utf-8'
只有功能是分开但不是猫
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">2</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">ointment</str>
<str name="rows">10</str>
<str name="version">2.2</str>
</lst>
</lst>
<result name="response" numFound="1" start="0">
<doc>
<arr name="cat"><str>lotion|medicine|ointment</str></arr>
<arr name="features"><str>15SPF</str><str>waterproof</str><str>kidsfriendly</str></arr>
<str name="id">SPF15</str>
<bool name="inStock">true</bool>
<str name="manu">P&G</str>
<date name="manufacturedate_dt">2011-02-13T15:26:37Z</date>
<str name="name">Hawaii Sunblock</str>
<int name="popularity">8</int>
<float name="price">8.99</float>
<str name="store">35.0752,-97.032</str>
</doc>
</result>
</response>
当我切换字段,功能和猫的顺序时,
curl 'http://localhost:8080/solr/update/csv?commit=true&f.cat.split=true&f.cat.separator=%7Cf.features.split=true&f.features.separator=%7C' --data-binary @input.csv -H 'Content-type:text/plain; charset=utf-8'
只有猫被分割,但不是功能
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">2</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">ointment</str>
<str name="rows">10</str>
<str name="version">2.2</str>
</lst>
</lst>
<result name="response" numFound="1" start="0">
<doc>
<arr name="cat"><str>lotion</str><str>medicine</str><str>ointment</str></arr>
<arr name="features"><str>15SPF|waterproof|kidsfriendly</str></arr>
<str name="id">SPF15</str>
<bool name="inStock">true</bool>
<str name="manu">P&G</str>
<date name="manufacturedate_dt">2011-02-13T15:26:37Z</date>
<str name="name">Hawaii Sunblock</str>
<int name="popularity">8</int>
<float name="price">8.99</float>
<str name="store">35.0752,-97.032</str>
</doc>
</result>
</response>
我检查了各种参考资料和教程,没有在同一个请求中拆分多个字段的例子,但没有理由说它应该有效。
有什么想法吗?
谢谢
答案 0 :(得分:2)
您错过了&
。尝试:
curl 'http://localhost:8080/solr/update/csv?commit=true&f.features.split=true&f.features.separator=%7C&f.cat.split=true&f.cat.separator=%7C' --data-binary @input.csv -H 'Content-type:text/plain; charset=utf-8'
(请注意,我在&
之后添加了%7C