Skip to content

Commit d2bc39e

Browse files
committed
#29 한글 검색 안되는 문제 수정
1 parent 5bff972 commit d2bc39e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

js/search.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
}
3131
}
3232

33+
function trimmerEnKo(token) {
34+
return token
35+
.replace(/^[^\w-]+/, '')
36+
.replace(/[^\w-]+$/, '');
37+
};
38+
3339
var searchTerm = getQueryVariable('query');
3440

3541
if (searchTerm) {
@@ -38,6 +44,12 @@
3844
// Initalize lunr with the fields it will be searching on. I've given title
3945
// a boost of 10 to indicate matches on this field are more important.
4046
var idx = lunr(function () {
47+
this.pipeline.reset();
48+
this.pipeline.add(
49+
trimmerEnKo,
50+
lunr.stopWordFilter,
51+
lunr.stemmer
52+
);
4153
this.field('id');
4254
this.field('title', { boost: 10 });
4355
this.field('author');

0 commit comments

Comments
 (0)