Hi Marian,

I guess that your problem isn't related to the number of results, but to the
component's configuration. The configuration that you show is meant to set
up an autocomplete component that will suggest terms from an incomplete user
input (something similar to what google does while you're typing in the
search box), see http://wiki.apache.org/solr/Suggester. That's why your
suggestions to "place" are "places" and "placed", all sharing the "place"
prefix. But when you search for "placw", the component doesn't return any
suggestion, because in your index no term begins with "placw".

You can learn how to correctly configure a spellchecker here:
http://wiki.apache.org/solr/SpellCheckComponent. Also, I'd recommend to take
a look at the example's solrconfig, because it provides an example
spellchecker configuration.

Regards,

*Juan*

On Mon, Jul 4, 2011 at 7:30 AM, Marian Steinbach <marian.steinb...@gmail.com
> wrote:

> Hi!
>
> I want my spellchecker component to return search query suggestions,
> regardless of the number of items in the search results. (Actually I'd
> find it most useful in zero-hit cases...)
>
> Currently I only get suggestions if the search returns one ore more hits.
>
> Example: q=place
>
> <response>
>  <result name="response" numFound="20" start="0" maxScore="2.2373123"/>
>  <lst name="spellcheck">
>    <lst name="suggestions">
>      <lst name="place">
>        <int name="numFound">4</int>
>        <int name="startOffset">0</int>
>        <int name="endOffset">5</int>
>        <arr name="suggestion">
>          <str>place</str>
>          <str>places</str>
>          <str>placed</str>
>        </arr>
>      </lst>
>      <str name="collation">place</str>
>    </lst>
>  </lst>
> </response>
>
> Example: q=placw
>
> <response>
>  <result name="response" numFound="0" start="0" maxScore="0.0"/>
>  <lst name="spellcheck">
>    <lst name="suggestions"/>
>  </lst>
> </response>
>
> This is my spellchecker configuration (where I already fiddled around
> more than probably useful):
>
> <searchComponent class="solr.SpellCheckComponent" name="suggest">
>  <lst name="spellchecker">
>    <str name="name">suggest</str>
>    <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
>    <str
> name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
>    <str name="field">autocomplete</str>
>    <float name="threshold">0.005</float>
>    <str name="accuracy">0.1</str>
>    <str name="buildOnCommit">true</str>
>    <float name="thresholdTokenFrequency">.0000001</float>
>  </lst>
> </searchComponent>
> <requestHandler
> class="org.apache.solr.handler.component.SearchHandler"
> name="/suggest">
>  <lst name="defaults">
>    <str name="wt">json</str>
>    <str name="spellcheck">true</str>
>    <str name="spellcheck.dictionary">suggest</str>
>    <str name="spellcheck.onlyMorePopular">false</str>
>    <str name="spellcheck.count">4</str>
>    <str name="spellcheck.collate">true</str>
>  </lst>
>  <arr name="components">
>    <str>suggest</str>
>  </arr>
> </requestHandler>
>
>
> Did I misunderstand anything?
>
> Thanks!
>

Reply via email to