You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Romi <ro...@gmail.com> on 2011/05/31 08:05:15 UTC

How to display solr search results in Json format

I have indexed all my database data in solr, now I want to rum search on it
and display results in JSON. what i need to do for it.


-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-display-solr-search-results-in-Json-format-tp3004734p3004734.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to display solr search results in Json format

Posted by "bmdakshinamurthy@gmail.com" <bm...@gmail.com>.
I am little confused about your question.

Incase you are looking to access the json object returned by solr, decode
the json object using a programming language of you choice. The document set
can be accessed using $json['response']['docs'](in PHP). This is an array of
hashes(associative arrays). Each element of this array is one document. You
can iterate through this document and display the results as doc[fieldname].

But if you are looking for the internals of the JSON response writer, you
can look at the JSONResponseWriter.java in package org.apache.solr.request.


On Tue, May 31, 2011 at 11:52 AM, Romi <ro...@gmail.com> wrote:

> Thanks for reply, But i want to know how Json does it internally, I mean
> how
> it display results as Field:value.
>
> -----
> Thanks & Regards
> Romi
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-display-solr-search-results-in-Json-format-tp3004734p3004768.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Thanks and Regards,
DakshinaMurthy

Re: How to display solr search results in Json format

Posted by Romi <ro...@gmail.com>.
Thanks for reply, But i want to know how Json does it internally, I mean how
it display results as Field:value.

-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-display-solr-search-results-in-Json-format-tp3004734p3004768.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to display solr search results in Json format

Posted by "bmdakshinamurthy@gmail.com" <bm...@gmail.com>.
Hi Romi,

When querying the Solr index, use 'wt=json' as part of your query string to
get the results back in json format.

On Tue, May 31, 2011 at 11:35 AM, Romi <ro...@gmail.com> wrote:

> I have indexed all my database data in solr, now I want to rum search on it
> and display results in JSON. what i need to do for it.
>
>
> -----
> Thanks & Regards
> Romi
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-display-solr-search-results-in-Json-format-tp3004734p3004734.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Thanks and Regards,
DakshinaMurthy BM