No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 43 commits behind dominictarr:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.travis.yml
LICENSE
README.md
bytewise.js
example.js
index.js
npm-example.js
package.json
pairs.js

README.md

level-search

index every property in leveldb

travis

testling

example

First, install the indexer, and then fill your leveldb with data.

var level  = require('level')
var sub    = require('level-sublevel')
var search = require('search')

var db = sub(level(pathToLevelDir, {valueEncoding: 'json'}))
var index = search(db, 'index')

//then put loads of JSONdata into the database...
streamOfJSON //with {key:..., value:...}
.pipe(db.createWriteStream())

//then query the database like this!

//retrive all the modules someone wrote...
index.createSearchStream(['maintainers', true, 'name', username])
  .on('data', console.log)

rebuilding the index

If want to add search to old data, or have been messing with stuff, you'll need to rebuild indexes.

index.rebuild(function (err) {
  //the search index is ready to be used again
})

If you insert keys while the rebuild, strange things could happen, so if you do that, you need to rebuild again.

License

MIT