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 multiValued or not. > The JSONResponseWriter of Solr looks at the schema-configuration. > However, the client shouldn't do that. > How did you solved that problem?
I didn't. I'm not recreating JSON from the SolrJ results. I would try to use the same classes that SolrJ uses, actually. (Writing that without having a further look at the code.) I would avoid recreating existing code as much as possible. About multivalued fields: you need instanceof checks, I guess. The field only contains a list if there really are multiple values. (That's what works for my ScriptTransformer.) Are you sure that you cannot change the SOLR results at query time according to your needs? Maybe you should ask for that, first (ask for X instead of Y...). Cheers, Chantal > > Thanks for sharing ideas. > > - Mitch > > > Am 28.07.2010 15:35, schrieb 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 , > >> > >> Second try to send a mail to the mailing list... > >> > >> I need to translate SolrJ's response into JSON-response. > >> I can not query Solr directly, because I need to do some math with the > >> responsed data, before I show the results to the client. > >> > >> Any experiences how to translate SolrJ's response into JSON without writing > >> your own JSON Writer? > >> > >> Thank you. > >> - Mitch > >> > > > > > >