solr 拼写检查器

发布于 2024-09-30 06:19:13 字数 540 浏览 0 评论 0原文

我已经根据此处给出的 fieldType 实现了 solr 拼写检查器: http://wiki.apache.org/solr/SpellCheckingAnalysis 将对供应商名称进行拼写检查,其中应给出与输入的搜索词相关的建议。 我已将 copyField 用于上述类型的vendorName 字段,即textSpell 我的一些查询得到了奇怪的整理结果。 例如 1)梅西百货没有给我任何结果,而梅西百货给了我想要的结果,即梅西百货。我比较了 maccys 和 maccys 的文本分析(管理工具)。梅西百货同时使用文字和文字textSpell 字段类型都给出了梅西作为最终结果。那么为什么拼写检查器没有返回结果呢?

2) khols 给我“鞋子”整理结果,其中正确的结果“kohls”是(鞋子和商店)之后的第三个建议。

onlyMorePopular 标志为 false,准确度默认为 0.5

提前感谢您的帮助。我在进一步调试方面有点迷失。

I have implemented the solr spellchecker based on the fieldType given here :
http://wiki.apache.org/solr/SpellCheckingAnalysis
The spellchecking is to be done for vendor names where suggestions should be given related to the search term entered.
I have used copyField for the vendorName field of the above type i.e. textSpell
I am getting weird collated results for some of my queries.
e.g.
1) maccys does not give me any results where as maccy's gives me the desired result i.e. macy's. I compared the text analysis (admin tool) done for maccys & maccy's using both text & textSpell fieldtypes and both give macy as the endresult. So why is there no result returned from the spellchecker?

2) khols gives me 'shoes' the collated result where as the correct result 'kohls' is the third suggestion after (shoes & shops).

The onlyMorePopular flag is false and accuracy is the default of 0.5

Thanks in advance for any help. I am slightly lost in terms of debugging any further.

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

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

发布评论

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

评论(1

反目相谮 2024-10-07 06:19:13

尽管我们有大量可用数据,但我们也遇到了拼写检查器产生奇怪结果的同样问题。我无法帮助如何更好地调试它,但我可以告诉你我们做了什么:

  1. 我们按原样使用文本字段 - 没有空格或标准标记器!如果要索引的数据较少,不仅可以索引“hellorabbit”,还可以添加一个 shingle 过滤器,但这样会进一步破坏拼写检查索引

     
        <分析器>
            >
            <过滤器类=“solr.LowerCaseFilterFactory”/>
            <过滤器类=“solr.TrimFilterFactory”/>
            <过滤器类=“solr.PatternReplaceFilterFactory”
            模式=“[\-\.\/\(\),]”替换=“”替换=“全部”/>
        <过滤器类=“solr.StopFilterFactory”ignoreCase=“true”字=“spellstopwords.txt”/>                       
            
            <过滤器类=“solr.RemoveDuplicatesTokenFilterFactory”/>
         
     
    
  2. 如果您确实需要排序规则(如果您不这样做)不使用 shingle 过滤器,您将需要它)您可以使用 trunk 中的 solr,您可以在其中指定 maxCollat​​ionTries=1 以确保返回的更正会产生一些命中

  3. 我们使用pellcheck.accuracy=0.7(并且 onlyMorePopular=false)

We have faced same problems for spellchecker producing weird results although we had a lot of data available. I cannot help how to debug it better, but I can tell you what we did:

  1. we are using a text field as it is - no whitespace or standard tokenizer! you can also add a shingle filter if you have less data to index not only "hello rabbit" but also "rabbit hello", but this will blow up the spellcheck index even more

     <fieldType name="txtspell" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
        <analyzer>
            <tokenizer class="solr.KeywordTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.TrimFilterFactory" />
            <filter class="solr.PatternReplaceFilterFactory"
            pattern="[\-\.\/\(\),]" replacement=""  replace="all"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="spellstopwords.txt"/>                       
            <!-- we don't want duplicates for one doc -->
            <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
         </analyzer>
     </fieldType>
    
  2. if you really need collation then (if you don't use shingle filter you'll need it) you can use solr from trunk where you can specify maxCollationTries=1 to be sure that the returned correction would produce some hits

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