Given the following csv file:
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"
When I run this command
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'
Only features is split but not cat
<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>
When I switch the order of fields, features and cat,
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; char开发者_开发百科set=utf-8'
Only cat is split, but not features
<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>
I checked various references and tutorials, there are no examples of splitting multiple fields in the same request but there is no reason why it should work.
Any idea?
Thank you
You are missing an &
. Try:
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'
(Note that I have added a &
after %7C
)
精彩评论