Skip to content

Commit

Permalink
search: tweak lunrjs (#1236)
Browse files Browse the repository at this point in the history
  • Loading branch information
MykolaGolubyev authored Sep 29, 2024
1 parent f6ef4d9 commit bba49df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions znai-core/src/main/resources/lunrjs/indexCreation.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ var stopWordFilter = createStopWordFilter([

znaiSearchIdx = lunr(function () {
this.pipeline.remove(lunr.stemmer)
this.pipeline.remove(lunr.stopWordFilter)
this.pipeline.add(stopWordFilter)
this.ref('id')
this.field('section')
this.field('pageTitle')
Expand Down
6 changes: 3 additions & 3 deletions znai-reactjs/src/doc-elements/search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class Search {
const lowestBoost = 0.05
const matches = this.searchIdx.query(q => {
term.split(lunr.tokenizer.separator).forEach(function (term) {
// if (term.length <= 2) {
// return
// }
if (term.length <= 2) {
return
}

q.term(term, { fields: [ 'pageTitle' ], boost: highestBoost })
q.term(term, { fields: [ 'pageSection' ], boost: highestBoost })
Expand Down

0 comments on commit bba49df

Please sign in to comment.