How to use the lunr.stopWordFilter 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 mozilla / platform-status / src / js / search.js View on Github external
function buildSearchIndex(features) {
  // index schema
  const searchIndex = lunr(function didLoad() {
    this.field('title', { boost: 100 });
    this.field('slug', { boost: 100 });
    this.field('summary', { boost: 10 });
    this.field('category', { boost: 1 });
    this.ref('slug');
  });

  searchIndex.pipeline.remove(lunr.stopWordFilter);

  // ingest documents
  features.forEach((doc) => {
    // quick n dirty html strip. not for security.
    doc.summary = doc.summary.replace(/<[^>]+>/g, '');
    searchIndex.add(doc);
  });

  return searchIndex;
}
github rubykit / kit / kit / libs / kit-doc-yard / assets / src / js / search.js View on Github external
return lunr(function () {
    this.ref('ref')
    this.field('title', {boost: 3, extractor: titleExtractor})
    this.field('doc')
    this.metadataWhitelist = ['position']
    this.pipeline.remove(lunr.stopWordFilter)

    searchNodes.forEach(function (doc) {
      this.add(doc)
    }, this)
  })
}
github Soluto / tweek / services / editor-new / server / searchIndex.js View on Github external
index = lunr(function () {
        this.tokenizer.separator = separator;
        this.pipeline.remove(lunr.stopWordFilter);
        this.ref('id');
        this.field('id');
        this.field('description');
        this.field('tags');
        this.field('name');

        files.forEach(function (doc) {
            this.add(doc);
        }, this);
    });
}
github numenta / numenta-web / packages / components / src / Search / index.jsx View on Github external
this._index = lunr(function () {
      this.ref('path')
      this.field('title', {boost: 10})
      this.field('text')
      this.pipeline.remove(lunr.stopWordFilter)
    })
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 Soluto / tweek / services / editor / modules / server / searchIndex.js View on Github external
index = lunr(function () {
    this.tokenizer.separator = separator;
    this.pipeline.remove(lunr.stopWordFilter);
    this.ref('id');
    this.field('id');
    this.field('description');
    this.field('tags');
    this.field('name');

    files.forEach(function (doc) {
      this.add(doc);
    }, this);
  });
}