Skip to content

Commit b592883

Browse files
committed
fix($plugin-search): support non-latin characters
1 parent 88ccbc6 commit b592883

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ TODOs.md
2323
# Typescript build dist
2424
packages/@vuepress/shared-utils/lib/
2525
packages/@vuepress/shared-utils/types/
26+
27+
#Test Coverage
28+
/coverage

packages/@vuepress/plugin-search/match-query.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import get from 'lodash/get'
32

43
export default (query, page, additionalStr = null) => {
@@ -28,15 +27,14 @@ const matchTest = (query, domain) => {
2827
.map((word, index) => {
2928
if (words.length === index + 1 && !hasTrailingSpace) {
3029
// The last word - ok with the word being "startswith"-like
31-
return `(?=.*\\b${escapeRegExp(word)})`
30+
return `(?=.*${escapeRegExp(word)})`
3231
} else {
3332
// Not the last word - expect the whole word exactly
34-
return `(?=.*\\b${escapeRegExp(word)}\\b)`
33+
return `(?=.*${escapeRegExp(word)}.*)`
3534
}
3635
})
3736
.join('') + '.+',
3837
'gi'
3938
)
4039
return searchRegex.test(domain)
4140
}
42-

0 commit comments

Comments
 (0)