1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        es-ikES上使用IK中文分詞器

        聯(lián)合創(chuàng)作 · 2023-09-29 05:14

        IK中文分詞器在Elasticsearch上的使用。原生IK中文分詞是從文件系統(tǒng)中讀取詞典,es-ik本身可擴展成從不同的源讀取詞典。目前提供從sqlite3數(shù)據(jù)庫中讀取。es-ik-plugin-sqlite3使用方法:

        1. 在elasticsearch.yml中設(shè)置你的sqlite3詞典的位置:

        ik_analysis_db_path: /opt/ik/dictionary.db

        我提供了默認的詞典:https://github.com/zacker330/es-ik-sqlite3-dictionary

        2. 安裝(目前是1.0.1版本)

        ./bin/plugin -i ik-analysis -u https://github.com/zacker330/es-ik-plugin-sqlite3-release/raw/master/es-ik-sqlite3-1.0.1.zip

        3. 現(xiàn)在可以測試了:

            1. 創(chuàng)建index

        curl -X PUT -H "Cache-Control: no-cache" -d '{
            "settings":{
                "index":{
                    "number_of_shards":1,
                    "number_of_replicas": 1
                }
            }
        }' 'http://localhost:9200/songs/'

              2. 創(chuàng)建map:

        curl -X PUT -H "Cache-Control: no-cache" -d '{
                "song": {
                    "_source": {"enabled": true},
                    "_all": {
                        "indexAnalyzer": "ik_analysis",
                        "searchAnalyzer": "ik_analysis",
                        "term_vector": "no",
                        "store": "true"
                    },
                    "properties":{
                        "title":{
                            "type": "string",
                            "store": "yes",
                            "indexAnalyzer": "ik_analysis",
                            "searchAnalyzer": "ik_analysis",
                            "include_in_all": "true"
                        }
                    }
        
                }
        }
            ' 'http://localhost:9200/songs/_mapping/song'

               3.

        curl -X POST  -d '林夕為我們作詞' 'http://localhost:9200/songs/_analyze?analyzer=ik_analysis'
        
        response:
        {"tokens":[{"token":"林夕","start_offset":0,"end_offset":2,"type":"CN_WORD","position":1},{"token":"作詞","start_offset":5,"end_offset":7,"type":"CN_WORD","position":2}]}

        瀏覽 15
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            看黄片网站 | 夜夜夜操 | 操她视频 | 国产精品私拍 | 亚洲自拍自偷 | 国产豆花视频在线 | 99re88 | 成人福利观看 | 久久激情视频网 | 风骚少妇图片 |