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 Matthew Runo <mr...@zappos.com> on 2007/12/07 19:51:57 UTC
SolrJ and MoreLikeThis / Spellchecker
Hello!
Please forgive my newbie question about SolrJ, but I was unable to
find my answer in the SOLRJ source code or the wiki (I'll add it if
someone helps).
Would anyone be so kind as to provide a quick example of using the
Spellcheck handler and the MoreLikeThis handler with SOLR-J?
The response format for it is so different, I'm not quite sure that my
normal way of looping through the result docs would work - there are
no docs in the XML (spellchecker included, as a sample).
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">22</int>
</lst>
<str name="words">runing</str>
<str name="exist">false</str>
<arr name="suggestions">
<str>Running</str>
</arr>
</response>
Thanks!
Matthew Runo
Software Developer
702.943.7833
Re: SolrJ and MoreLikeThis / Spellchecker
Posted by Mike Klaas <mi...@gmail.com>.
Trunk has much more data in its spellcheck response, see http://
wiki.apache.org/solr/SpellCheckerRequestHandler .
-Mike
On 7-Dec-07, at 3:46 PM, Matthew Runo wrote:
> I'll give it a try. Seems like the Spellcheck response type is
> pretty basic.
>
> Thanks!
>
> Matthew Runo
> Software Developer
> 702.943.7833
>
> On Dec 7, 2007, at 11:23 AM, Ryan McKinley wrote:
>
>> Matthew Runo wrote:
>>> Hello!
>>> Please forgive my newbie question about SolrJ, but I was unable
>>> to find my answer in the SOLRJ source code or the wiki (I'll add
>>> it if someone helps).
>>> Would anyone be so kind as to provide a quick example of using
>>> the Spellcheck handler and the MoreLikeThis handler with SOLR-J?
>>
>> With spellcheck, you will be in new water (I think)... you can get
>> the response as a NamedList, but there is not anything that puts
>> that into user friendly functions.
>>
>> SolrQuery q = new SolrQuery( "foo" );
>> q.setQueryType( "spelling" );
>> q.set( "anyparam", value );
>> QueryResponse rsp = solr.query( q )
>>
>> NamedList nl = rsp.getResponse();
>>
>> you will have to pick stuff out of the NamedList manually. If you
>> want to contribute a SpellCheckRequest/Response that would be great!
>>
>> For MLT, the standard QueryRequest should work. in 1.3-dev, both
>> standard and dismax support mlt queries. Perhaps we should add
>> getters and setters to SolrQuery so you don't have to call:
>> q.set( MoreLikeThisParams.MLT, true );
>>
>>
>> ryan
>>
>
Re: SolrJ and MoreLikeThis / Spellchecker
Posted by Matthew Runo <mr...@zappos.com>.
I'll give it a try. Seems like the Spellcheck response type is pretty
basic.
Thanks!
Matthew Runo
Software Developer
702.943.7833
On Dec 7, 2007, at 11:23 AM, Ryan McKinley wrote:
> Matthew Runo wrote:
>> Hello!
>> Please forgive my newbie question about SolrJ, but I was unable to
>> find my answer in the SOLRJ source code or the wiki (I'll add it if
>> someone helps).
>> Would anyone be so kind as to provide a quick example of using the
>> Spellcheck handler and the MoreLikeThis handler with SOLR-J?
>
> With spellcheck, you will be in new water (I think)... you can get
> the response as a NamedList, but there is not anything that puts
> that into user friendly functions.
>
> SolrQuery q = new SolrQuery( "foo" );
> q.setQueryType( "spelling" );
> q.set( "anyparam", value );
> QueryResponse rsp = solr.query( q )
>
> NamedList nl = rsp.getResponse();
>
> you will have to pick stuff out of the NamedList manually. If you
> want to contribute a SpellCheckRequest/Response that would be great!
>
> For MLT, the standard QueryRequest should work. in 1.3-dev, both
> standard and dismax support mlt queries. Perhaps we should add
> getters and setters to SolrQuery so you don't have to call:
> q.set( MoreLikeThisParams.MLT, true );
>
>
> ryan
>
Re: SolrJ and MoreLikeThis / Spellchecker
Posted by Ryan McKinley <ry...@gmail.com>.
Matthew Runo wrote:
> Hello!
>
> Please forgive my newbie question about SolrJ, but I was unable to find
> my answer in the SOLRJ source code or the wiki (I'll add it if someone
> helps).
>
> Would anyone be so kind as to provide a quick example of using the
> Spellcheck handler and the MoreLikeThis handler with SOLR-J?
>
With spellcheck, you will be in new water (I think)... you can get the
response as a NamedList, but there is not anything that puts that into
user friendly functions.
SolrQuery q = new SolrQuery( "foo" );
q.setQueryType( "spelling" );
q.set( "anyparam", value );
QueryResponse rsp = solr.query( q )
NamedList nl = rsp.getResponse();
you will have to pick stuff out of the NamedList manually. If you want
to contribute a SpellCheckRequest/Response that would be great!
For MLT, the standard QueryRequest should work. in 1.3-dev, both
standard and dismax support mlt queries. Perhaps we should add getters
and setters to SolrQuery so you don't have to call:
q.set( MoreLikeThisParams.MLT, true );
ryan