Skip to content

Commit 8af85c6

Browse files
committed
feat(build.sh, index.js): add 拼音搜索 OI-wiki/OI-wiki#3145
1 parent 1f6aede commit 8af85c6

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
curl -X DELETE "http://localhost:9200/oiwiki"
2+
curl -H'Content-Type: application/json' -XPUT "http://localhost:9200/oiwiki" -d'
3+
{
4+
"settings": {
5+
"analysis": {
6+
"analyzer": {
7+
"default": {
8+
"tokenizer": "ik_max_word",
9+
"filter": "custom_pinyin"
10+
},
11+
"default_search": {
12+
"tokenizer": "ik_max_word"
13+
}
14+
},
15+
"filter": {
16+
"custom_pinyin": {
17+
"type": "pinyin",
18+
"keep_original": true,
19+
"limit_first_letter_length": 16
20+
}
21+
}
22+
}
23+
}
24+
}'

webhook/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ handler.on('push', (event) => {
158158
});
159159

160160
function init() {
161-
exec(`curl -X DELETE "http://localhost:9200/oiwiki"`);
161+
exec(`bash build.sh`);
162162
let modified = [];
163163
const file = String(fs.readFileSync(`/home/ubuntu/OI-wiki/mkdocs.yml`));
164164
const data = YAML.parse(file.replaceAll('!!python/name:', ''));

0 commit comments

Comments
 (0)