Skip to content

Commit

Permalink
npm run dist
Browse files Browse the repository at this point in the history
  • Loading branch information
neilboyd committed Aug 7, 2024
1 parent 2d72e4c commit bc164c2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
14 changes: 12 additions & 2 deletions dest/simple-jekyll-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ function FuzzySearchStrategy () {

var _$LiteralSearchStrategy_6 = new LiteralSearchStrategy()

const segmenter = new Intl.Segmenter([], { granularity: 'word' })

function LiteralSearchStrategy () {
this.matches = function (str, crit) {
if (!str) return false
Expand All @@ -93,9 +95,17 @@ function LiteralSearchStrategy () {
crit = crit.substring(1, crit.length - 1)
}
crit = crit.toLowerCase()
crit = exact ? [crit] : crit.split(' ')
let critArray = [crit]
if (!exact) {
const segmentedText = segmenter.segment(crit)
critArray = [...segmentedText].filter(s => s.isWordLike).map(s => s.segment)
}

return crit.filter(word => str.indexOf(word) >= 0).length === crit.length
return (
critArray
.filter((word) => str.indexOf(word) >= 0)
.length === critArray.length
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion dest/simple-jekyll-search.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions example/js/simple-jekyll-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ function FuzzySearchStrategy () {

var _$LiteralSearchStrategy_6 = new LiteralSearchStrategy()

const segmenter = new Intl.Segmenter([], { granularity: 'word' })

function LiteralSearchStrategy () {
this.matches = function (str, crit) {
if (!str) return false
Expand All @@ -93,9 +95,17 @@ function LiteralSearchStrategy () {
crit = crit.substring(1, crit.length - 1)
}
crit = crit.toLowerCase()
crit = exact ? [crit] : crit.split(' ')
let critArray = [crit]
if (!exact) {
const segmentedText = segmenter.segment(crit)
critArray = [...segmentedText].filter(s => s.isWordLike).map(s => s.segment)
}

return crit.filter(word => str.indexOf(word) >= 0).length === crit.length
return (
critArray
.filter((word) => str.indexOf(word) >= 0)
.length === critArray.length
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/js/simple-jekyll-search.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bc164c2

Please sign in to comment.