: 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}]},

You are not looking at JSON data -- you are looking at a simple "toString" 
value from the QueryResponse java object.  It's not intended to be 
used for anything beyond debugging.

if you want the raw JSON data from Solr, then you should either *not* use 
SolrJ (most of that code is for parsing hte response into Java objects and 
you aparently don't want that) ... or: you should specify your own 
ResponseParser that will give you access to the raw stream of JSON...

  class YourRawResponseParser extends ResponseParser {
    // ...
    processResponse(InputStream body, String encoding) {
      // ...
      // do some JSON processing of body
      // ...
    }
  }

But this assumes you want the raw JSON values returned by Solr -- 
previously you mentioned that you were trying to *create* JSON using the 
data returned by Solr using a JSON generating library -- in which case you 
may in fact waht to use Solr's binary response format, get the structured 
java object response, and then walk it pulling out just the pieces of data 
fro mthe response you want, and pass those specific values to your JSON 
generation library.

It's hard to tell, because you haven't really elaborated on what it is you 
are trying to do -- all you've made clear is that that you are getting 
invalid JSON from a method that has never ever been ment to return JSON...

https://people.apache.org/~hossman/#xyproblem
XY Problem

Your question appears to be an "XY Problem" ... that is: you are dealing
with "X", you are assuming "Y" will help you, and you are asking about "Y"
without giving more details about the "X" so that we can understand the
full issue.  Perhaps the best solution doesn't involve "Y" at all?
See Also: http://www.perlmonks.org/index.pl?node_id=542341




-Hoss
http://www.lucidworks.com/

Reply via email to