Skip to content

Commit 7b84f22

Browse files
committed
feat: 添加char_filter将特殊字符转义
1 parent d7f8e05 commit 7b84f22

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

build.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ curl -H'Content-Type: application/json' -XPUT "http://localhost:9200/oiwiki" -d'
77
"analyzer": {
88
"pinyin_analyzer": {
99
"tokenizer": "ik_max_word",
10-
"filter": "pinyin_filter"
10+
"filter": "pinyin_filter",
11+
"char_filter": ["special_mapping"]
1112
},
1213
"pinyin_search_analyzer": {
13-
"tokenizer": "ik_max_word"
14+
"tokenizer": "ik_max_word",
15+
"char_filter": ["special_mapping"]
1416
},
1517
"ngram_analyzer": {
16-
"tokenizer": "ngram_tokenizer"
18+
"tokenizer": "ngram_tokenizer",
19+
"char_filter": ["special_mapping"]
1720
}
1821
},
1922
"filter": {
@@ -31,6 +34,17 @@ curl -H'Content-Type: application/json' -XPUT "http://localhost:9200/oiwiki" -d'
3134
"max_gram": 9,
3235
"token_chars": ["letter", "digit"]
3336
}
37+
},
38+
"char_filter": {
39+
"special_mapping":{
40+
"type": "mapping",
41+
"mappings": [
42+
"@=>.oiwikiAt.",
43+
"#=>.oiwikiJin.",
44+
"!=>.oiwikiSigh.",
45+
"*=>.oiwikiXing."
46+
]
47+
}
3448
}
3549
}
3650
},

0 commit comments

Comments
 (0)