robert laing
robert laing

Reputation: 1401

solr, when loading csv fields are converted to array

i'm loading a simple csv into a solr core, using post cli

this is example csv:

v21,v22
v31,v33

this is the loading:

solr create -c test
post -c test example.csv

let's query: http://localhost:8983/solr/test/select?indent=on&q=:&wt=json

{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"*:*",
      "indent":"on",
      "wt":"json"}},
  "response":{"numFound":2,"start":0,"docs":[
      {
        "v11":["v21"],
        "v12":["v22"],
        "id":"f91582c7-9cfa-48db-813e-05b672261186",
        "_version_":1566774492373450752},
      {
        "v11":["v31"],
        "v12":["v33"],
        "id":"540fc0c0-0036-4823-8db3-bbb8bb3fb170",
        "_version_":1566774492421685248}]
  }}

all csv fields are array into solr, "v11":["v31"]
what is wrong?

Upvotes: 0

Views: 284

Answers (1)

Vinod
Vinod

Reputation: 1953

Check field declaration for "v11" , "v12" in schema file, you might have given multivalue=true. remove it or set to false.

multiValued="false"

example:

<field name="v11" type="text_general" indexed="true" stored="true" multiValued="false"/>

Upvotes: 0

Related Questions