olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.87k stars 547 forks source link

add is not a function #448

Closed paopaol closed 4 years ago

paopaol commented 4 years ago

1f81608f30ba2b187f8e15663a5e027

rodrigorm commented 4 years ago

The add method is defined on build and should be put inside the lunr call:

lunr(function () {
  this.add(doc);
});
olivernn commented 4 years ago

Since version 2 adding documents to an index must be done when defining the index, just like @rodrigorm says.