Open zhaohanweng opened 8 years ago
Hello, could you please provide steps and code to reproduce this? Thanks.
schema: default schema + the following line in the fields.
<field name="hobbies" type="text_general" indexed="true" stored="true" multiValued="true"/>
data:
{ userId: 1, hobbies: ['soccer'] },
{ userId: 2, hobbies: ['soccer', 'tennis'] }
create solr-index-user
for this schema, then create bucket props with this solr-index-user
.
insert the data into this bucket.
code:
riak.search({
indexName: 'solr-index-user',
q: "*:*"
})
results:
[ {
"hobbies": "soccer",
"userId": "1"
},
......
searching through http api
will give array result even if it's one item.
http://localhost:8098/search/query/solr-index-user?wt=json&q=*:*
results:
"docs": [
{
"userId": "1",
"hobbies": [
"soccer"
],
"_yz_id": "1*data*user*1*12",
"_yz_rk": "1",
"_yz_rt": "data",
"_yz_rb": "user"
}
.....
If the multiVauled field has 2 or more string items, then it will return array of string, which is correct. But if only have one item, it will return string instead of array of a single string.