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 Markus Lang <ma...@gmail.com> on 2016/09/28 12:50:46 UTC

Solr Spellchecker with weighted Dictionary

Hello,
is it possible to configure the Solr Spellchecker Component to use a
weighted dictionary?

At the moment I use the solr.SuggestComponent because it provides the
possibility to use a "sourceLocation" with weights for each entry. But this
leads me to a different problem:

e.g. I have the following entries in my sourceLocation:

berlin 14
berlin wall 42
london bridge 32

and the user uses the query "berlin" then I get the suggestion "berlin
wall" because of the higher weight of this entry. But in this case "berlin"
would be perfectly fine query on it's own, since I actually don't want to
suggest a completion but simpy a spell correction.
On the other hand, if the user queries for "london" or "lundon" it is
intended to suggest "london bridge", since the word "london" alone is not
in the sourceLocation.


At the moment I use this configuration:


  <searchComponent class="solr.SuggestComponent" name="didYouMean">
    <lst name="suggester">
      <str name="name">didYouMean</str>
      <str
name="lookupImpl">org.apache.solr.spelling.suggest.fst.FuzzyLookupFactory</str>
      <str
name="dictionaryImpl">org.apache.solr.spelling.suggest.FileDictionaryFactory</str>
      <str name="sourceLocation">conf/queries.txt</str>
      <str name="fieldDelimiter">\t</str>
      <str name="storeDir">didYouMeanCache</str>
      <str name="suggestAnalyzerFieldType">string</str>
      <str name="buildOnStartup">true</str>
      <str name="buildOnCommit">true</str>
      <!-- FuzzyLookupFactory properties: -->
      <str name="maxEdits">2</str>
      <str name="nonFuzzyPrefix">1</str>
      <str name="unicodeAware">true</str>
    </lst>
  </searchComponent>

  <requestHandler name="/didYouMean" class="solr.SearchHandler">
    <lst name="defaults">
      <str name="suggest">true</str>
      <str name="suggest.build">true</str>
      <str name="suggest.count">5</str>
    </lst>

    <arr name="components">
      <str>didYouMean</str>
    </arr>
  </requestHandler>


Thanks and best Regards
Markus