lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Jha <shanuu....@gmail.com>
Subject Re: DateField - Invalid JSON String Exception - converting Query Response to JSON Object
Date Tue, 07 Jan 2014 22:07:23 GMT
Hey Hoss,

Thanks for replying back..Here is the response generated by solrj.




*SolrJ Response*: ignore the Braces at It have copied it from big chunk

Response:
{responseHeader={status=0,QTime=0,params={lowercaseOperators=true,sort=score
desc,cache=false,qf=content,wt=javabin,rows=100,defType=edismax,version=2,fl=*,score,start=0,q="White+Paper",stopwords=true,fq=type:"White
Paper"}},response={numFound=9,start=0,maxScore=0.61586785,docs=[SolrDocument{id=007,
type=White Paper, source=Documents, title=White Paper 003, body=White Paper
004 Body, author=[Author 3], keywords=[Keyword 3], description="Vivamus
turpis eros", mime_type=pdf, _version_=1456609602022932480,
*publication_date=Wed
Jan 08 03:16:06 IST 2014*, score=0.61586785}]},

Please the publication_date value, Whenever I enable "stored=true" for this
field I got the error

*org.json.JSONException: Expected a ',' or '}' at 853 [character 854 line
1]*

*Solr Query String*
q=%22White%2BPaper%22&qf=content&start=0&rows=100&sort=score+desc&defType=edismax&stopwords=true&lowercaseOperators=true&wt=json&cache=false&fl=*%2Cscore&fq=type%3A%22White+Paper%22

Hope this may help you to answer.




On Tue, Jan 7, 2014 at 10:29 PM, Chris Hostetter
<hossman_lucene@fucit.org>wrote:

>
> : We have index where date field have default value as 'NOW'. We are using
> : solrj to query solr and when we try to convert query
> : response(response.getResponse) to JSON object in java. The JSON
>
> You're going to have to show us some real code, some real data, and a real
> error exception that you are getting -- because it's not at all clear what
> you are trying to do, or why you would get an error about invalid JSON.
>
> If you generate a JSON response from Solr, you'll get properly quoted
> strings for the dates...
>
> $ curl 'http://localhost:8983/solr/collection1/query?q=SOLR&fl=*_dt&'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":8,
>     "params":{
>       "fl":"*_dt",
>       "q":"SOLR"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "incubationdate_dt":"2006-01-17T00:00:00Z"}]
>   }}
>
>
> ...but it appears you are trying to *generate* JSON yourself, using the
> Java objects you get back from a parsed SolrJ response -- so i'm not sure
> where you would be getting an error about invalid JSON, unless you were
> doing something invalid in the code you are writing to create that JSON.
>
>
> -Hoss
> http://www.lucidworks.com/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message