How to add SpellCheckResponse to Solritas?

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

How to add SpellCheckResponse to Solritas?

Jan Høydahl / Cominvent
Hi,

I'm using the /itas requestHandler, and would like to add spell-check suggestions to the output.
I'm having spell-check configured and working in the XML response writer, but nothing is output in Velocity. Debugging the JSON $response object, I cannot find any representation of spellcheck response in there.

Where do I plug that in?

--
Jan Høydahl  - search architect
Cominvent AS - www.cominvent.com

Reply | Threaded
Open this post in threaded view
|

Re: How to add SpellCheckResponse to Solritas?

Erik Hatcher-4
Let me understand the issue... Have you added spellchecking parameters  
to the /itas mapping in solrconfig.xml?   If so, you should be able to  
do /itas?q=mispeled&wt=xml and see the suggestions in the response.  
If you've gotten that far you'll be able to navigate to them using the  
object navigation of $response in the templates.

The output of $response, just to be clear, isn't really JSON, it's a  
toString() that looks similar though.  Or did you convert it to JSON  
in some other fashion?  /itas?q=mispeled&wt=json should also show the  
spelling suggestions.

        Erik

On Feb 9, 2010, at 7:30 PM, Jan Høydahl / Cominvent wrote:

> Hi,
>
> I'm using the /itas requestHandler, and would like to add spell-
> check suggestions to the output.
> I'm having spell-check configured and working in the XML response  
> writer, but nothing is output in Velocity. Debugging the JSON  
> $response object, I cannot find any representation of spellcheck  
> response in there.
>
> Where do I plug that in?
>
> --
> Jan Høydahl  - search architect
> Cominvent AS - www.cominvent.com
>

Reply | Threaded
Open this post in threaded view
|

Re: How to add SpellCheckResponse to Solritas?

Jan Høydahl / Cominvent
My problem was that spellcheck component was missing from /itas handler.

With that in place, I could use $response.response.spellcheck.suggestions.collation (no idea why I needed $response.response?) to pick up the spellcheck.

Now it works quite well: http://ec2-79-125-69-12.eu-west-1.compute.amazonaws.com:8983/solr/itas?q=conector

Perhaps I should submit this as my first patch to the Solr project :)

--
Jan Høydahl  - search architect
Cominvent AS - www.cominvent.com

On 11. feb. 2010, at 15.06, Erik Hatcher wrote:

> Let me understand the issue... Have you added spellchecking parameters to the /itas mapping in solrconfig.xml?   If so, you should be able to do /itas?q=mispeled&wt=xml and see the suggestions in the response.  If you've gotten that far you'll be able to navigate to them using the object navigation of $response in the templates.
>
> The output of $response, just to be clear, isn't really JSON, it's a toString() that looks similar though.  Or did you convert it to JSON in some other fashion?  /itas?q=mispeled&wt=json should also show the spelling suggestions.
>
> Erik
>
> On Feb 9, 2010, at 7:30 PM, Jan Høydahl / Cominvent wrote:
>
>> Hi,
>>
>> I'm using the /itas requestHandler, and would like to add spell-check suggestions to the output.
>> I'm having spell-check configured and working in the XML response writer, but nothing is output in Velocity. Debugging the JSON $response object, I cannot find any representation of spellcheck response in there.
>>
>> Where do I plug that in?
>>
>> --
>> Jan Høydahl  - search architect
>> Cominvent AS - www.cominvent.com
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: How to add SpellCheckResponse to Solritas?

Erik Hatcher-4

On Feb 11, 2010, at 12:21 PM, Jan Høydahl / Cominvent wrote:
> With that in place, I could use  
> $response.response.spellcheck.suggestions.collation (no idea why I  
> needed $response.response?) to pick up the spellcheck.

$response.response is needed in the Velocity templates because  
$response is a SolrResponse (most often QueryResponse).  To get just  
the response you have to navigate another level down,  
QueryResponse.getResponse().

Making these context variables a bit less confusing has been something  
I've pondered for a while.  Suggestions welcome for improvement.

> Perhaps I should submit this as my first patch to the Solr project :)

Not a bad idea!  Contributions more than welcome.

        Erik