2.0.0 • Published 4 years ago

flumeview-search v2.0.0

Weekly downloads
413
License
MIT
Repository
github
Last release
4 years ago

flumeview-search

fulltext search as a flumeview.

example

var FlumeViewSearch = require('flumeview-search')
var pull = require('pull-stream')
var Flume = require('flumedb')
var OffsetLog = require('flumelog-offset')

var minLength = 3 //index words at least this long

var db = Flume(OffsetLog('/tmp/flume-search-example'))

  .use('search', FlumeViewSearch(1, minLength, function (doc) {
    return doc.text //return the string you want indexed
  })

pull(
  db.search.query({query: 'foo bar baz', limit: 10}),
  pull.drain(console.log)
)

api

FlumeViewSearch(version, minLength, map) => search

version is the view version. if this number changes to what is on disk, the index will regenerate.

minLength is the minimum word length to index. by default this is 3 letters.

map is a function that takes the document, and returns a string containing the text to be indexed.

search.query ({query, limit, keys, values}) => PullSource

create a pull-stream source of results for this query. query should be a string, and may contain multiple words. (words shorter than minLength are ignored) The order is in reverse chronological order.

License

MIT

2.0.0

4 years ago

1.0.7

4 years ago

1.0.6

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago