lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan McKinley" <ryan...@gmail.com>
Subject Re: RequestHandler -> XML/JSON/etc. response?
Date Fri, 16 Feb 2007 20:37:43 GMT
why not just the standard list format so we don't have to write new parsers :)

   List<String> suggestions = new ArrayList<String>();
    suggestions.add( "suggestion 1" );
    suggestions.add( "suggestion 2" );
    suggestions.add( "suggestion 3" );
    suggestions.add( "suggestion 4" );
    rsp.add( "suggestions", suggestions );

gives:

<arr name="suggestions">
 <str>suggestion 1</str>
 <str>suggestion 2</str>
 <str>suggestion 3</str>
 <str>suggestion 4</str>
</arr>

or:

"suggestions":[
  "suggestion 1",
  "suggestion 2",
  "suggestion 3",
  "suggestion 4"],

we can get the numSuggestions from the array length

ryan



On 2/16/07, Otis Gospodnetic <otis_gospodnetic@yahoo.com> wrote:
> Hi,
>
>
>
> I'm still torturing SOLR-81 - the spellchecker fronted with a Solr RequestHandler.
>
> Being a RequestHandler virgin, I'm not sure how to go from getting the alternative
>
> spelling suggestion(s) in the RequestHandler, to the output that might look something
>
> like this (made it up on the spot, please point out any weaknesses):
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <response>
>
> <responseHeader>Is the response header really needed?</responseHeader>
>
>
>
> <result numSuggestions="N">
>
>  <suggestion>suggestion 1</suggestion>
>
>  ...
>
>  <suggestion>suggestion N</suggestion>
>
> </result>
>
> </response>
>
>
>
> I'm looking at StandardRequestHandler, trying to base y RequestHandler on it, but I don't
see where the results get XML-ified.
> I see  rsp.add("response",results.docList);  and friends, but it's not clear to me at
this crazy hour at night how that makes it to the XMLWriter or XMLResponseWriter, or some
other class that finally spits out XML.
>
> Can somebody please point me in the right direction?
>
> Thanks,
>
> Otis
>
>
>
>
>
>

Mime
View raw message