简体   繁体   中英

Solr - Suggester

Can anyone give me a good Solr Suggester example, I tried to get a phrase suggest using "Solr Suggest" then used "Spell Checker" but didn't get what I needed. Anything on this would help.

Just need a good example link that explains what is done in detail, or at least something close.

Well, I am unable to edit my previous answer(deleted now :/). Here is the code snippet for implementing suggestion feature:

<searchComponent name="suggest" class="solr.SuggestComponent">
        <lst name="suggester">
  <str name="name">mySuggester</str>
  <str name="lookupImpl">AnalyzingInfixLookupFactory</str>      <!-- org.apache.solr.spelling.suggest.fst -->
  <str name="lookupImpl">FuzzyLookupFactory</str>  
  <str name="dictionaryImpl">DocumentDictionaryFactory</str>     <!-- org.apache.solr.spelling.suggest.HighFrequencyDictionaryFactory -->
  <str name="field">name</str>
  <str name="weightField">price</str>
  <str name="suggestAnalyzerFieldType">text_general</str>
  <int name="maxEdits">2</int>
 </lst>
</searchComponent>

<requestHandler name="/suggest" class="solr.SearchHandler"  startup="lazy">
<lst name="defaults">
<str name="df">text</str>
  <str name="suggest">true</str>
  <str name="suggest.count">10</str>
  <str name="suggest.dictionary">mySuggester</str>
</lst>
<arr name="last-components">
  <str>suggest</str>
</arr>
</requestHandler>

Note : AnalyzingInfixLookupFactory allows you to search for infixes as well. Suppose your search item is Squash and the user types uash , Squash will be provided as a suggestion.

FuzzyLookupFactory will allow you to provide suggestion even when the user does a spelling mistake .

The following link should help you to implement a phrase suggest.

http://solr.pl/en/2010/11/15/solr-and-autocomplete-part-2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM