Adding xml to SolrQueryResponse

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

Adding xml to SolrQueryResponse

maustin
Is there a way to add attributes besides name to an xml node returned from
SolrQueryResponse? I've looked at the SolrQueryResponse.add and it looks
like a NamedList is my only option.  I know that I can get by with nodes
that have only the name attribute but it would make life a little easier to
throw some more attributes on a node.

Thanks,
Mike Austin
Reply | Threaded
Open this post in threaded view
|

Re: Adding xml to SolrQueryResponse

Yonik Seeley
On 5/1/06, Mike Austin <[hidden email]> wrote:
> Is there a way to add attributes besides name to an xml node returned from
> SolrQueryResponse? I've looked at the SolrQueryResponse.add and it looks
> like a NamedList is my only option.  I know that I can get by with nodes
> that have only the name attribute but it would make life a little easier to
> throw some more attributes on a node.

There isn't currently, and making things too extensible will get you
back to unconstrained XML again (might as well use DOM or something).

Hmmm, but one could put random XML in the response by making an XML
type that you would get if you put a DOM object in the NamedList for
the response.

<response>
  <result> // normal Solr result </result>

  <xml name="foo"><random><xml myattr="foo" myattr2="bar/><baz>hi</baz></random>

</response>


-Yonik
Reply | Threaded
Open this post in threaded view
|

Re: Adding xml to SolrQueryResponse

Chris Hostetter-3
In reply to this post by maustin
: Is there a way to add attributes besides name to an xml node returned from
: SolrQueryResponse? I've looked at the SolrQueryResponse.add and it looks
: like a NamedList is my only option.  I know that I can get by with nodes
: that have only the name attribute but it would make life a little easier to
: throw some more attributes on a node.

FYI: The orriginal thinking behind the current XML format was that
itshould only contain concepts that were easy to map to the "primitive"
types found in most type safe langauges: int/float/date/string/etc...
<lst> exists to provide a simple mechanism to support both: Ordered lists
of heterogenously typed objects; and Un-Ordered name/value pairs  ... all
depending on what you prefer.

Allowing arbitrarry attributes would complicate that simple mapping of tag
to primitive object -- Which doesn't mean I'm opposed to the idea, I
acctually think it would be nice if there was a simple way to add a DOM
sub-trees directly to the response -- but I'd advocate not having any core
Solr code use this ... mainly because one of the "Near Term" goals is to
get an XML DTD/Schema that validates all legal responses from any (real or
theoretical) RequestHandler.  Allowing arbitrary XL attributes would
illiminate SolrCore's ability to ensure that the XML responses it
generates validate with that DTD/Schema -- so if we did add support for
it, we'd want to treat it special in some way.

-Hoss