pouchdb-lunr

0.1.1 • Public • Published

pouchdb-lunr

Some PouchDB sugar around lunr.js

Installation

npm install pouchdb pouchdb-lunr

Usage

import PouchDB from 'pouchdb';
import LunrPlugin from 'pouchdb-lunr';
PouchDB.plugin(LunrPlugin);
 
const db = new PouchDB('mydb');
 
db.lunr('fruits', function() {
  this.field('name');
}, function(idx, doc) {
  if (doc.type === 'fruit') {
    idx.add({
      id: doc._id,
      name: doc.name
    });
  }
});
 
db.lunrSearch('fruits', 'banana').then(function(res) {
  //res has same properties as db.allDocs()
});

Author

Niklas Närhinen

License

MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    1
  • 0.1.0
    0

Package Sidebar

Install

npm i pouchdb-lunr

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • nnarhinen