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 Mike Austin <ma...@gmail.com> on 2006/05/01 22:53:41 UTC

Adding xml to SolrQueryResponse

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

Re: Adding xml to SolrQueryResponse

Posted by Chris Hostetter <ho...@fucit.org>.
: 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


Re: Adding xml to SolrQueryResponse

Posted by Yonik Seeley <ys...@gmail.com>.
On 5/1/06, Mike Austin <ma...@gmail.com> 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