247916 (1) [Avatar] Offline
#1
Hi, let me just say what a fun book to work through. The lorikeet file explorer tool is the kind of project I could easily see using to do other things, like categorizing pictures.

So I installed the latest version of lunr@2.0.4 (author's code uses 0.7.2). So I get an error: 'Uncaught TypeError: index.add is not a function', which is called from search.js method: addToIndex(file).

I understand new versions aren't always backwards compatible. Has anyone looked at trying to fix the lorikeet code to use new versions of lunr?

Other than release notes, are the units tests that are supplied with npm packages usually a good way to understand how a package changes from one version to the next?

Cheers,
Ira
paulbjensen (39) [Avatar] Offline
#2
Hi,

I'll take a look at this now.
paulbjensen (39) [Avatar] Offline
#3
So, the 2.0 update to Lunr introduced a major change to the library - adding documents to an index has to happen when the index is being configured, as the indexes operate as immutable data.

See this GH thread: https://github.com/olivernn/lunr.js/issues/259

I will try and see how to make Lorikeet work with Lunr.js 2.0 tomorrow.
0degreesk (1) [Avatar] Offline
#4
I've run into this same issue. I would prefer to get instruction on how to fix the problem in Lorikeet using the latest version of Lunr, however in order to continue with the book, I did the following.

Uninstalled the version of Lunr that wasn't working:
npm uninstall lunr


Then installed the version of Lunr used in the book:
npm install lunr@0.7.2 --save


This worked for me, but please provide the fix, thanks.

EDIT: I'm going through the book on Safari Books Online in case, perhaps, the version they have is old.