solr java client code and XML schema

classic Classic list List threaded Threaded
2 messages Options
Yao
Reply | Threaded
Open this post in threaded view
|

solr java client code and XML schema

Yao
Looks like there is no publish java client for solr - what a surprise. I
would assume it would be very useful for integrating solr into existing
apps.
Anyone has done parsing standard XML response to Java Objects? I would
like to create some strong typed object hierarchy instead bunch of
Collections and Maps. The current XML schema is very light and I was
having a hard time writing Digester rules. I am in the mid of write XSLT
to transform response into "easier" XML tags for Digester (such as
<header><status>0</status>...</header> instead of <lst
name='responseHeader'><int name='status'>0</int>...). Is there a good
reason for solr to not have a particular rich XML schema?
 
-Yao
Reply | Threaded
Open this post in threaded view
|

Re: solr java client code and XML schema

Yonik Seeley-2
On 4/21/07, Ge, Yao (Y.) <[hidden email]> wrote:
> Looks like there is no publish java client for solr - what a surprise. I
> would assume it would be very useful for integrating solr into existing
> apps.

The leading candidate is https://issues.apache.org/jira/browse/SOLR-20
Feedback is welcome... I haven't had a chance to look at it much myself.

> Anyone has done parsing standard XML response to Java Objects? I would
> like to create some strong typed object hierarchy instead bunch of
> Collections and Maps. The current XML schema is very light and I was
> having a hard time writing Digester rules. I am in the mid of write XSLT
> to transform response into "easier" XML tags for Digester (such as
> <header><status>0</status>...</header> instead of <lst
> name='responseHeader'><int name='status'>0</int>...). Is there a good
> reason for solr to not have a particular rich XML schema?

Solr also supports custom request handlers, where people can add
relatively arbitrary data to a response (Maps, Lists/Arrays, etc).
The current XML format reflects this flexibility.

One can choose different output formats (response writers), so when a
request handler adds an integer array to a response, it could be
written by the xml response writer as
  <arr><int>1</int><int>2</int></arr>
or by the JSON response writer as
  [1,2]

If you want a different XML format, there are a few ways to do it:
 - a custom response writer
 - server side XSLT transformation via the xslt response writer

Hopefully if you come up with Digester rules for Solr, or another XML
format that people find useful, you could contribute it back (with
your employer's permission of course).

-Yonik