Tabnine Logo For Javascript
elasticlunr
Code IndexAdd Tabnine to your IDE (free)

How to use elasticlunr

Best JavaScript code snippets using elasticlunr(Showing top 6 results out of 315)

origin: BuildingXwithJS/bxjs-weekly

folderToDocuments(linksPath)
 .each(result => {
  index.addDoc(result);
 })
 .done(() => {
  const indexJSON = index.toJSON();
  fs.writeFile(indexPath, JSON.stringify(indexJSON), () => {
   console.log('Successfully saved index!');
  });
 });
origin: sinedied/hads

search(string) {
  return this.index.search(string, {
   expand: true
  });
 }
origin: sinedied/hads

constructor(basePath) {
  this.basePath = basePath;
  this.index = elasticlunr(function () {
   this.setRef('file');
   this.addField('filename');
   this.addField('content');
  });
  this.files = [];
 }
origin: sinedied/hads

updateIndexForFile(file) {
  const filePath = path.relative(this.basePath, file);
  this.files.push(filePath);

  return fs.readFile(path.join(this.basePath, filePath), 'utf8')
   .then(content => {
    const doc = {
     file: filePath,
     filename: path.basename(filePath, path.extname(filePath)),
     content
    };
    this.index[this.index.documentStore.hasDoc(filePath) ? 'updateDoc' : 'addDoc'](doc);
    return doc;
   });
 }
origin: sinedied/hads

getContent(file) {
  return this.index.documentStore.getDoc(file).content;
 }
origin: BuildingXwithJS/bxjs-weekly

const run = async () => {
 await folderToDocuments(linksPath, {arrayMod})
  .each(result => index.addDoc(result))
  .toPromise(Promise);
 console.log('Successfully generated index!');
elasticlunr(npm)

Most used elasticlunr functions

  • DocumentStore.getDoc
  • DocumentStore.hasDoc
  • Index.addDoc
  • Index.documentStore
  • Index.search
  • addField,
  • elasticlunr,
  • setRef

Popular in JavaScript

  • semver
    The semantic version parser used by npm.
  • aws-sdk
    AWS SDK for JavaScript
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • http
  • js-yaml
    YAML 1.2 parser and serializer
  • crypto
  • body-parser
    Node.js body parsing middleware
  • axios
    Promise based HTTP client for the browser and node.js
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now