Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Lunr.js 2.0 introduces changes that break Lorikeet #5

Open
paulbjensen opened this issue Jun 4, 2017 · 2 comments
Open

Lunr.js 2.0 introduces changes that break Lorikeet #5

paulbjensen opened this issue Jun 4, 2017 · 2 comments

Comments

@paulbjensen
Copy link
Owner

See thread: https://forums.manning.com/posts/list/40877.page

Lunr.js 2.0 has switched to immutable indexes, which means that indexes need to be created with the documents in the configuration, rather than added/removed later (as per the 0.x-1.x approach of Lunr).

This means that to make Lorikeet work with the current version of Lunr.js, I will need to change how the code functions. There will be a separate feature branch that will not be merged into the master branch, but act as a fork for people to use when wanting to try Lorikeet with Lunr.js 2.0.

@stackcats
Copy link

Lunr.js 2.0

// search.js
function resetIndex(files = []) {
  index = lunr(function() {
    this.field('file');
    this.field('type');
    this.ref('path');
    for (const file of files) {
      this.add(file);
    }
  });
}
// userInterface.js
function displayFiles(err, files) {  
  if (err) {
    return alert(err);
  }
  resetIndex(files);   // add resetIndex here
  return files.forEach(displayFile);
}

@memory125
Copy link
Contributor

Awesome....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants