Re: SolrJ Response + JSON

2010-08-02 Thread MitchK
Hi, as I promised, I want to give a feedback for transforming SolrJ's output into JSON with the package from json.org (the package was the json.org's one): I need to make a small modification to the package, since they store the JSON-key-value-pairs in a HashMap, I changed this to a LinkedHa

Re: SolrJ Response + JSON

2010-07-29 Thread Mats Bolstad
What I meant is that GSON do not wrap the response as follows: { "responseHeader":{ "status":0, "QTime":x}, "response":{"numFound":x,"start":0,"docs":[ { /* docs */ }] }, "facet_counts":{ "facet_queries":{}, "facet_fields":{}, "facet_dates":{}}} If you car

Re: SolrJ Response + JSON

2010-07-29 Thread Mitch Köhler
Hi Mat, sounds very interesting, because it seems to be so easy. You say, that this could comply with Solr's JSON-format. What are your experiences regarding the differences? I mean, JSON is a standard, so what can be different? Thank you! - Mitch Am 29.07.2010 09:42, schrieb Mats Bolstad: I

Re: SolrJ Response + JSON

2010-07-29 Thread Mats Bolstad
If you don't mind your JSON format complying with the one Solr uses, you could use GSON. SolrQuery solrQuery = new SolrQuery("your query"); QueryResponse response = server.query(solrQuery); List beans = response.getBeans(YourObject.class); // some computing ... GSON gson = new GSON(); String json

Re: SolrJ Response + JSON

2010-07-28 Thread Ranveer
Rajani is right you can get response by passing wt=json. But I think if you want to use solrj then you will require to parse binary format data in json format or you can use third party json parser. regards Ranveer http://www.onlymyhealth.com On Thursday 29 July 2010 09:55 AM, rajini maski wro

Re: SolrJ Response + JSON

2010-07-28 Thread rajini maski
Yeah right... This query will do it http://localhost:8090/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on&wt=json This will do your work... This is more liike using xsl transformation supported by solr..:) Regards, Rajani Maski On Wed, Jul 28, 2010 at 6:24 PM, Mark Allan wrote:

Re: SolrJ Response + JSON

2010-07-28 Thread MitchK
Hi Chantal, thank you for the feedback. I did not see the wood for the trees! The SolrDocument's javadoc says the following: http://lucene.apache.org/solr/api/org/apache/solr/common/SolrDocument.html |*getFieldValue <../../../../org/apache/solr/common/SolrDocument.html#getFieldValue%28java.la

Re: SolrJ Response + JSON

2010-07-28 Thread Chantal Ackermann
Hi Mitch On Wed, 2010-07-28 at 16:38 +0200, MitchK wrote: > Thank you, Chantal. > > I have looked at this one: http://www.json.org/java/index.html > > This seems to be an easy-to-understand-implementation. > > However, I am wondering how to determine whether a SolrDocument's field > is multiVa

Re: SolrJ Response + JSON

2010-07-28 Thread MitchK
Thank you, Chantal. I have looked at this one: http://www.json.org/java/index.html This seems to be an easy-to-understand-implementation. However, I am wondering how to determine whether a SolrDocument's field is multiValued or not. The JSONResponseWriter of Solr looks at the schema-configurat

Re: SolrJ Response + JSON

2010-07-28 Thread Chantal Ackermann
You could use org.apache.solr.handler.JsonLoader. That one uses org.apache.noggit.JSONParser internally. I've used the JacksonParser with Spring. http://json.org/ lists parsers for different programming languages. Cheers, Chantal On Wed, 2010-07-28 at 15:08 +0200, MitchK wrote: > Hello , > > S

Re: SolrJ Response + JSON

2010-07-28 Thread MitchK
Thank you Markus, Mark. Seems to be a problem with Nabble, not with the mailing list. Sorry. I can create a JSON-response, when I query Solr directly. But I mean, that I query Solr through a SolrJ-client (CommonsHttpSolrServer). That means my queries look a litte bit like that: http://wiki.apa

Re: SolrJ Response + JSON

2010-07-28 Thread Markus Jelsma
Hi, I got a response to your e-mail in my box 30 minutes ago. Anyway, enable the JSONResponseWriter, if you haven't already, and query with wt=json. Can't get mucht easier. Cheers, On Wednesday 28 July 2010 15:08:26 MitchK wrote: > Hello , > > Second try to send a mail to the mailing list...

Re: SolrJ Response + JSON

2010-07-28 Thread Mark Allan
On 28 Jul 2010, at 2:08 pm, MitchK wrote: Second try to send a mail to the mailing list... Your first attempt got through as well. Here's my original response. I think you should just be able to add &wt=json to the end of your query (or change whatever the existing wt parameter is in your

Re: SolrJ Response + JSON

2010-07-28 Thread Mark Allan
I think you should just be able to add &wt=json to the end of your query (or change whatever the existing wt parameter is in your URL). Mark On 28 Jul 2010, at 12:54 pm, MitchK wrote: Hello community, I need to transform SolrJ - responses into JSON, after some computing on those results