Solr Suggester 是否支持中缀搜索?

发布于 2024-10-22 05:59:49 字数 135 浏览 6 评论 0原文

Solr Suggester 组件的 wiki 页面 没有提到如何搜索提供的字段?它只是一个前缀,还是也可以进行中缀搜索?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

念﹏祤嫣 2024-10-29 05:59:49

是的,它支持。
编辑 solrconfig.xml,转到 searchComponent 元素,从 org.apache.solr.spelling.suggest.tst.TSTLookupFactory 更改“lookupImpl”的值(如 Solr Suggester 组件的 wiki 页面 示例,但它可以是另一个类似 FuzzyLookupFactory 等...)到 AnalyzingInfixLookupFactory。

它需要与此非常相似:

<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>

更改后不要忘记重新启动 solr。

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.

醉城メ夜风 2024-10-29 05:59:49

您可以针对具有 N-Gram Tokenizer 在其分析链中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文