zoukankan      html  css  js  c++  java
  • Solr 同义词搜索

    1.  进入solr配置目录

    cd /usr/local/solr/solrhome/collection1/conf

    vi schema.xml 

    增加配置节  

    <fieldType name="text_syn" class="solr.TextField"> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/>

    <filter class="solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/>

    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />

    <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType>

    2.修改字段搜索类型  

    <field name="item_DB_KeyWords" type="text_syn" indexed="true" stored="true"/>

    保存  :wq

    3.修改同义词配置文件   

    vi synonyms.txt

    纸,A4纸,打印纸,复印纸

    保存:wq

    4.修改扩展词

    vi protwords.txt

    A4纸 打印纸 复印纸

    :wq

    5.重启tomcat

    cd /usr/local/solr/tomcat/bin

    ./shutdown.sh  停止

    ./startup.sh  启动

    6.删除solr服务器数据  

    <delete><query>*:*</query></delete>
    <commit/>

    7.同步数据到solr服务器

    8.测试搜索

  • 相关阅读:
    WCF上传下载文件
    WCF使用相关
    .net WCF WF4.5 状态机、书签与持久化
    .net WCF WF4.5
    CSS小东西
    asp.net mvc导出execl_转载
    winform自定义控件开发
    html问题汇总
    工作中的小东西
    jQuery事件
  • 原文地址:https://www.cnblogs.com/xiaoxiangpaou/p/8590351.html
Copyright © 2011-2022 走看看