开发者

Does Solr Suggester support infix search?

The wiki page of the Solr Suggester component does not mention how 开发者_运维知识库the provided field is searched? Is it a prefix only, or is there also an infix search possible?


Yes, It supported. Edit your solrconfig.xml, go to searchComponent element, change value of "lookupImpl" from org.apache.solr.spelling.suggest.tst.TSTLookupFactory(As shown in wiki page of the Solr Suggester component example, but it can be another like FuzzyLookupFactory etc...) to AnalyzingInfixLookupFactory.

It's need to be very similar to this:

<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
 <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">yourSearchFieldName</str>
<str name="suggestAnalyzerFieldType">yourSearchFieldType(String, text-general)</str>
<str name="buildOnStartup">true</str>
</lst>
</searchComponent>

<requestHandler name="/suggest" class="solr.SearchHandler" 
              startup="lazy" >
<lst name="defaults">
  <str name="suggest">true</str>
  <str name="suggest.count">10</str>
</lst>
<arr name="components">
  <str>suggest</str>
</arr>
</requestHandler>

Don't forget to restart your solr after changes.


You can do "infix" or n-gram style auto-suggest activity against an indexed field that has an N-Gram Tokenizer in it's analysis chain.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜