给solr加spell check

1 篇文章 0 订阅
1 篇文章 0 订阅

在schema.xml中添加如下内容:

<!-- A copied field for spellcheck. As it has the same stuff as the above _text_, you can use the _text_ for spellcheck in this case. But creating another dedicated copied field for spellcheck has more flexibility. -->
    <field name="spell" type="text_general" indexed="true" stored="false" multiValued="true"/>
    <copyField source="*" dest="spell"/>

同时在solrconfig.xml的<searchComponent name="spellcheck" class="solr.SpellCheckComponent"></searchComponent>中添加一下内容

<lst name="spellchecker">
    <str name="name">indexbasedchecker</str>
    <!-- The classname is optional, defaults to IndexBasedSpellChecker -->
    <str name="classname">solr.IndexBasedSpellChecker</str>
    <!--
        Load tokens from the following field for spell checking,
        analyzer for the field's type as defined in schema.xml are used
    -->
    <str name="field">spell</str>
    <!-- Optional, by default use in-memory index (RAMDirectory) -->
    <str name="spellcheckIndexDir">./spellchecker</str>
    <!-- Set the accuracy (float) to be used for the suggestions. Default is 0.5 -->
    <str name="accuracy">0.7</str>
    <!-- Require terms to occur in 1/100th of 1% of documents in order to be included in the dictionary -->
    <float name="thresholdTokenFrequency">.0001</float>
    </lst>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值