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