Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
const expandTerm = term => '*' + lunr.stemmer(new lunr.Token(term, {})) + '*';