using spellcheckcomponent via solrj

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

using spellcheckcomponent via solrj

Jason Rennie-2
I've got SpellCheckComponent working on my index using queries like so:

/solr/spellCheckCompRH?q=shart&spellcheck.q=shart&spellcheck=true&qt=sfdismax

But, I haven't had any luck getting solrj to produce such queries.  I can't
find any way to change the url from /solr/select to /solr/spellCheckCompRH.
I found a post from a month ago indicating that it can be done.  Can someone
fill me in on what I'm missing?

I see that solrj has support for the spellcheck response, so it looks like
dealing with the response will be easy once I get the query right.

Jason

P.S. Thanks to everyone who had a hand in adding this functionality.  It
looks quite useful!
Reply | Threaded
Open this post in threaded view
|

Re: using spellcheckcomponent via solrj

Erik Hatcher

On Sep 24, 2008, at 3:22 PM, Jason Rennie wrote:

> I've got SpellCheckComponent working on my index using queries like  
> so:
>
> /solr/spellCheckCompRH?
> q=shart&spellcheck.q=shart&spellcheck=true&qt=sfdismax
>
> But, I haven't had any luck getting solrj to produce such queries.  
> I can't
> find any way to change the url from /solr/select to /solr/
> spellCheckCompRH.
>
> I found a post from a month ago indicating that it can be done.  Can  
> someone
> fill me in on what I'm missing?

  SolrQuery query = new SolrQuery("shart")
  query.setQueryType("/spellCheckCompRH")

        Erik


Reply | Threaded
Open this post in threaded view
|

Re: using spellcheckcomponent via solrj

Jason Rennie-2
On Wed, Sep 24, 2008 at 3:43 PM, Erik Hatcher <[hidden email]>wrote:

>  query.setQueryType("/spellCheckCompRH")
>

That's the trick I needed.  Thanks!

Jason
Reply | Threaded
Open this post in threaded view
|

Re: using spellcheckcomponent via solrj

Grant Ingersoll-2
In reply to this post by Erik Hatcher
You're other option is to just add the component to your normal  
request handler (i.e. select).  That was the main goal of writing it  
as a SearchComponent.  This way, you don't have to do a separate query  
to get spelling results.

Just mimic the configuration for the spellCheckCompRH in the handler  
that you use for querying.


On Sep 24, 2008, at 3:43 PM, Erik Hatcher wrote:

>
> On Sep 24, 2008, at 3:22 PM, Jason Rennie wrote:
>> I've got SpellCheckComponent working on my index using queries like  
>> so:
>>
>> /solr/spellCheckCompRH?
>> q=shart&spellcheck.q=shart&spellcheck=true&qt=sfdismax
>>
>> But, I haven't had any luck getting solrj to produce such queries.  
>> I can't
>> find any way to change the url from /solr/select to /solr/
>> spellCheckCompRH.
>>
>> I found a post from a month ago indicating that it can be done.  
>> Can someone
>> fill me in on what I'm missing?
>
> SolrQuery query = new SolrQuery("shart")
> query.setQueryType("/spellCheckCompRH")
>
> Erik
>
>


Reply | Threaded
Open this post in threaded view
|

Re: using spellcheckcomponent via solrj

Jason Rennie-2
On Wed, Sep 24, 2008 at 4:07 PM, Grant Ingersoll <[hidden email]>wrote:

> Just mimic the configuration for the spellCheckCompRH in the handler that
> you use for querying.


Sounds even better.  Let me make sure I'm reading you correctly.  Is the
idea to add lines like this to the requestHandler we normally use?

    <lst name="defaults">
      <!-- omp = Only More Popular -->
      <str name="spellcheck.onlyMorePopular">false</str>
      <!-- exr = Extended Results -->
      <str name="spellcheck.extendedResults">false</str>
      <!--  The number of suggestions to return -->
      <str name="spellcheck.count">1</str>
    </lst>
    <arr name="last-components">
      <str>spellcheck</str>
    </arr>

Thanks,

Jason
Reply | Threaded
Open this post in threaded view
|

Re: using spellcheckcomponent via solrj

Grant Ingersoll-2
Yep.  That's exactly it.  The spellCheckCompRH was merely an example  
of how to do the necessary configuration with out screwing up the  
other examples.

On Sep 24, 2008, at 4:22 PM, Jason Rennie wrote:

> On Wed, Sep 24, 2008 at 4:07 PM, Grant Ingersoll  
> <[hidden email]>wrote:
>
>> Just mimic the configuration for the spellCheckCompRH in the  
>> handler that
>> you use for querying.
>
>
> Sounds even better.  Let me make sure I'm reading you correctly.  Is  
> the
> idea to add lines like this to the requestHandler we normally use?
>
>    <lst name="defaults">
>      <!-- omp = Only More Popular -->
>      <str name="spellcheck.onlyMorePopular">false</str>
>      <!-- exr = Extended Results -->
>      <str name="spellcheck.extendedResults">false</str>
>      <!--  The number of suggestions to return -->
>      <str name="spellcheck.count">1</str>
>    </lst>
>    <arr name="last-components">
>      <str>spellcheck</str>
>    </arr>
>
> Thanks,
>
> Jason

--------------------------
Grant Ingersoll
http://www.lucidimagination.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ







Reply | Threaded
Open this post in threaded view
|

Re: using spellcheckcomponent via solrj

Jason Rennie-2
In reply to this post by Jason Rennie-2
Weird.  When I put all of the below XML in the requestHandler we normally
use, I always get zero results for requests.  However, if I only add the
"last-components" section, it works as expected (normal results, spellcheck
in response if I specify "spellcheck=true" in query).  Anyone know what
might be going on here?

Thanks,

Jason

On Wed, Sep 24, 2008 at 4:22 PM, Jason Rennie <[hidden email]> wrote:

> On Wed, Sep 24, 2008 at 4:07 PM, Grant Ingersoll <[hidden email]>wrote:
>
>> Just mimic the configuration for the spellCheckCompRH in the handler that
>> you use for querying.
>
>
> Sounds even better.  Let me make sure I'm reading you correctly.  Is the
> idea to add lines like this to the requestHandler we normally use?
>
>     <lst name="defaults">
>       <!-- omp = Only More Popular -->
>       <str name="spellcheck.onlyMorePopular">false</str>
>       <!-- exr = Extended Results -->
>       <str name="spellcheck.extendedResults">false</str>
>       <!--  The number of suggestions to return -->
>       <str name="spellcheck.count">1</str>
>     </lst>
>     <arr name="last-components">
>       <str>spellcheck</str>
>     </arr>
>
> Thanks,
>
> Jason
>
>


--
Jason Rennie
Head of Machine Learning Technologies, StyleFeeder
http://www.stylefeeder.com/
Samantha's blog & pictures: http://samanthalyrarennie.blogspot.com/