Skip to content

Instantly share code, notes, and snippets.

@olivernn
Created January 19, 2016 16:49
Show Gist options
  • Select an option

  • Save olivernn/7cd496f8654a0246c53c to your computer and use it in GitHub Desktop.

Select an option

Save olivernn/7cd496f8654a0246c53c to your computer and use it in GitHub Desktop.

Revisions

  1. olivernn created this gist Jan 19, 2016.
    10 changes: 10 additions & 0 deletions lunr.contraction_filter.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    lunr.contractionTrimmer = function (token) {
    return token.replace(/('ve|n't|'d|'ll|'ve|'s|'re)$/, "")
    }

    lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'contractionTrimmer')


    var englishContractions = function (idx) {
    idx.pipeline.after(lunr.trimmer, lunr.contractionTrimmer)
    }