GithubHelp home page GithubHelp logo

Comments (3)

feuyeux avatar feuyeux commented on June 11, 2024
index:
 analysis:
    filter:
      pinyin_filter:
        padding_char: ''
        type: pinyin
        first_letter: none
    tokenizer:
      my_pinyin:
        type: pinyin
        first_letter: prefix
        padding_char: ' '
    analyzer:
        pinyin_standard_analyzer:
            type: custom
            filter: word_delimiter
            tokenizer: my_pinyin
        pinyin_ngram_analyzer:
            type: custom
            filter: lowercase
            tokenizer: my_pinyin
        my_pinyin_ik:
            type: custom
            filter: pinyin_filter
            tokenizer: ik_smart
        my_ik_smart:
            type: custom
            tokenizer: ik_smart

from elasticsearch-analysis-pinyin.

ventlam avatar ventlam commented on June 11, 2024

mapping 在需要ik和拼音搜索的字段,使用multi_field。例子如下:

{
    "properties": {
        "title": {
            "type": "multi_field",
            "fields": {
                "pinyinszm": {
                    "type": "string",
                    "term_vector": "with_positions_offsets",
                    "analyzer": "pinyin_szm_analyzer",
                    "store": "no"
                },
                "title": {
                    "type": "string",
                    "analyzer": "ik_smart",
                    "store": "no"

                }
                ,
                "pinyin": {
                    "type": "string",
                    "term_vector": "with_positions_offsets",
                    "analyzer": "pinyin_analyzer",
                    "store":"no"

                }
            }
        }
    }
}

from elasticsearch-analysis-pinyin.

fly-studio avatar fly-studio commented on June 11, 2024

5.x

PUT http://127.0.0.1:9200/test/

 {
    "settings": {
        "analysis" : {
            "analyzer" : {
                "pinyin_analyzer" : {
                    "tokenizer" : "my_pinyin"
                },
                "ik_smart_pinyin":{
                    "type":"custom",
                    "tokenizer":"ik_max_word",
                    "filter":["single_pinyin"]
                }
            },
            "tokenizer" : {
                "my_pinyin" : {
                    "type" : "pinyin",
                    "keep_first_letter": true,
                    "keep_separate_first_letter" : true,
                    "keep_full_pinyin" : true,
                    "keep_joined_full_pinyin": true,
                    "keep_original" : true,
                    "limit_first_letter_length" : 16,
                    "lowercase" : true
                }
            },
            "filter": {
                "single_pinyin" :{
                    "type": "pinyin",
                    "keep_first_letter": true,
                    "keep_separate_first_letter" : true,
                    "keep_full_pinyin": true,
                    "keep_joined_full_pinyin": true,
                    "limit_first_letter_length" : 16,
                    "keep_original" : true,
                    "lowercase" : true
                }
            }
        }
    }
 }

from elasticsearch-analysis-pinyin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.