[英]How to insert data into multivalued field in SOLR?
管理模式
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="category" type="text_general" indexed="true" stored="true" multiValued="true"/>
data.csv
id category
1 CA,USA
2 DW,USA
3 NY,USA
饋入數據如下:
curl "http://localhost:8983/solr/demo/update/csv?wt=json&separator=%09&f.category.split=true&f.category.seperator=%2C&f.category.encapsulator='&commit=true" --data-binary @data.csv -H 'Content-type:text/plain; charset=utf-8'
我提到類別字段分隔符為%2c(編碼逗號),但是數據存儲為:
category:["CA,USA"]
我期望將數據存儲為:
category:["CA","USA"]
您的方法存在的問題是一個簡單的拼寫錯誤。
&f.category.seperator=%2C
它應該是&f.category.separator=%2C
。
我看到您已經用JSON方法解決了它。 但這也一樣有效。
我的分隔符存在問題,因為您正在使用文件分隔符作為eparator =%09,並且還使用了與f.category.seperator =%2C相同的分隔符多值字段
嘗試這個
curl http://localhost:8983/solr/update/csv?stream.file=exampledocs/books.csv&stream.contentType=text/plain;charset=utf-8
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.