Storing and retrieving json
Hello all, I am facing a need to store and retrieve json string in a field. eg. Imagine a schema like below. [Please note that this is just an example but not actual specification.] str name=carName type=string indexed=true stored=false str name=carDescription type=string indexed=false stored=false carDescription is a json string . An example would be { model:1988 type:manual} I dont need to search on the carDescription. I want to store some json data and retreive. When i feed json data to carDescription field through DIH, the response for the query is like below {\ model\:1988 \type\:\manual\} All the quotes are escaped. I dont want this. I want the original unmodified data. Is there a way to do this? Thanks, Karthick
Re: Storing and retrieving json
Yes, the quotes need to be escaped - since they are contained within a quoted string, which you didn't show. That is the proper convention for representing strings in JSON. Are you familiar with the JSON format? If not, try XML - it won't have to represent a string as a quoted JSON string. If you read and parse the Solr response with a JSON parser, you should get your original JSON string value back intact. Now, you may want to do a JSON parse of that string itself, but that has nothing to do with the Solr JSON response itself. As you said, you wanted to store and retrieve JSON as a string field, which Solr appears to be doing correctly. -- Jack Krupansky -Original Message- From: Karthick Duraisamy Soundararaj Sent: Wednesday, May 22, 2013 8:03 PM To: solr-user@lucene.apache.org Subject: Storing and retrieving json Hello all, I am facing a need to store and retrieve json string in a field. eg. Imagine a schema like below. [Please note that this is just an example but not actual specification.] str name=carName type=string indexed=true stored=false str name=carDescription type=string indexed=false stored=false carDescription is a json string . An example would be { model:1988 type:manual} I dont need to search on the carDescription. I want to store some json data and retreive. When i feed json data to carDescription field through DIH, the response for the query is like below {\ model\:1988 \type\:\manual\} All the quotes are escaped. I dont want this. I want the original unmodified data. Is there a way to do this? Thanks, Karthick
Re: Storing and retrieving json
I solved this: https://issues.apache.org/jira/browse/SOLR-4685 To get the field in there from XMl to JSON: https://issues.apache.org/jira/browse/SOLR-4692 EnjoY! On Wed, May 22, 2013 at 6:03 PM, Karthick Duraisamy Soundararaj karthick.soundara...@gmail.com wrote: Hello all, I am facing a need to store and retrieve json string in a field. eg. Imagine a schema like below. [Please note that this is just an example but not actual specification.] str name=carName type=string indexed=true stored=false str name=carDescription type=string indexed=false stored=false carDescription is a json string . An example would be { model:1988 type:manual} I dont need to search on the carDescription. I want to store some json data and retreive. When i feed json data to carDescription field through DIH, the response for the query is like below {\ model\:1988 \type\:\manual\} All the quotes are escaped. I dont want this. I want the original unmodified data. Is there a way to do this? Thanks, Karthick -- Bill Bell billnb...@gmail.com cell 720-256-8076