Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiValued="true" field returns string instead of array. [JIRA: CLIENTS-870] #159

Open
zhaohanweng opened this issue May 19, 2016 · 2 comments

Comments

@zhaohanweng
Copy link

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.

@Basho-JIRA Basho-JIRA changed the title multiValued="true" field returns string instead of array. multiValued="true" field returns string instead of array. [JIRA: CLIENTS-870] May 19, 2016
@lukebakken
Copy link
Contributor

Hello, could you please provide steps and code to reproduce this? Thanks.

@zhaohanweng
Copy link
Author

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"
      }
.....

@lukebakken lukebakken modified the milestone: riak-nodejs-client-2.5.0 Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants