Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
JavaScript
branch: master

This branch is 43 commits behind dominictarr:master

Failed to load latest commit information.
test test query arrays
.travis.yml unsupport 0.6
LICENSE initial
README.md document rebuild
bytewise.js initial
example.js tidy example
index.js add keys and values
npm-example.js example
package.json 1.4.0
pairs.js add rebuild

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

Something went wrong with that request. Please try again.