How to use the lunr.stemmer function in lunr

To help you get started, we’ve selected a few lunr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mongodb / marian / src / query.js View on Github external
function haveContiguousKeywords(phraseComponents, keywords) {
    const path = []
    for (const component of phraseComponents) {
        if (!lunr.stopWordFilter(component)) { continue }
        const stemmed = lunr.stemmer(new lunr.Token(component)).str
        const positions = keywords.get(stemmed)
        if (positions === undefined) {
            return false
        }
        path.push(positions)
    }

    return haveContiguousPath(path)
}
github Redocly / redoc / src / services / SearchWorker.worker.ts View on Github external
const expandTerm = term => '*' + lunr.stemmer(new lunr.Token(term, {})) + '*';