Skip to content

nnarhinen/pouchdb-lunr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Some pouchdb sugar around lunr.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published