Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

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

About

No description, website, or topics provided.

Resources

License

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •