<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

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

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

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

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

          ik_analysis_db_path: /opt/ik/dictionary.db

          我提供了默認(rèn)的詞典: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)在可以測(cè)試了:

              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
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  欧美日韩中文在线视频 | 免费性爱AV | 亚洲无码高清视频在线观看 | 欧美久久久久久 | 国产精品嫩草AV城中村 |