zoukankan      html  css  js  c++  java
  • solr6.6 配置同义词

      1、配置managed-schema

    <fieldType name="text_mmseg4j_simple" class="solr.TextField" positionIncrementGap="100">
        <analyzer>
          <filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms-cn.txt"/>
          <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple"/>
        </analyzer>
      </fieldType>
      <field name="text" type="text_mmseg4j_simple" termVectors="true" indexed="true" stored="true"/>

      2、同义词文件synonyms-cn.txt

      

    # The ASF licenses this file to You under the Apache License, Version 2.0
    # (the "License"); you may not use this file except in compliance with
    # the License.  You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    #-----------------------------------------------------------------------
    #some test synonym mappings unlikely to appear in real input text
    aaafoo => aaabar
    bbbfoo => bbbfoo bbbbar
    cccfoo => cccbar cccbaz
    fooaaa,baraaa,bazaaa
    
    # Some synonym groups specific to this example
    GB,gib,gigabyte,gigabytes
    MB,mib,megabyte,megabytes
    Television, Televisions, TV, TVs
    #notice we use "gib" instead of "GiB" so any WordDelimiterGraphFilter coming
    #after us won't split it into two words.
    
    # Synonym mappings can be used for spelling correction too
    pixima => pixma
    
    ideapad,ideacenter,lenovo,联想
    china,中国,中华人民共和国,华夏,中国大陆

     下面两种方式都可以

    联想,ideapad,ideacenter,lenovo
    联想 => ideapad,ideacenter,lenovo

      3、索引文件搜索

        

        

        

    
    
  • 相关阅读:
    [转]Asp.Net MVC EF各版本区别
    web攻击之七:常见CDN回源问题总结
    web攻击之六:DNS攻击原理与防范
    web攻击之四:DOS攻击
    web攻击之五:上传漏洞
    web攻击之三:SQL注入攻击的种类和防范手段
    web攻击之二:CSRF跨站域请求伪造
    TCP洪水攻击(SYN Flood)的诊断和处理
    DDoS攻防战(三):ip黑白名单防火墙frdev的原理与实现
    DDoS攻防战(二):CC攻击工具实现与防御理论--删除
  • 原文地址:https://www.cnblogs.com/shaosks/p/8065431.html
Copyright © 2011-2022 走看看