Search code examples
solrsolrj

quoted format json from Solrj


It looks like the QueryResponse from Solrj has no mean to give you a quoted Json string with wt=on or not. All I received is something like this

{responseHeader={status=0,QTime=2,params= {fl=id,productName,imageFront,priceEng,priceEngExp...

Question:

1) Am I missing something here ? Or there is no way to get the json response properly from the Solr server by Solrj.

2) Now on my client, if I convert the non-quoted json string from Solrj, does it mean it was done two times, once in server time and one in the Solrj client time ?


Solution

  • You can get JSON response by setting wt=json to the Solr query. Example URL is shown below :

    localhost:8983/solr/select/?q=:&rows=10&indent=on&wt=json

    You can't get JSON response using Solrj. You don't need to use Solrj for this purpose.By sending HTTP requests to the URL above, you can get json response.