opts
:
path
- required - the path to where the sqlite db should be stored/read fromcolumns
- required - an array of columns, e.g. ['foo', 'bar']
to use as the schema for the search tableprimaryKey
- required - the primary key that will be passed to since
and will by default order the columnreadyCallback
Will get called with err, instance
var sqliteSearch = require('sqlite-search')
sqliteSearch(opts, function (err, searcher) {
searcher.createSearchStream(searchOpts)
})
returns a writable object stream. objects written into this stream will be stored in the search table. make sure the keys of your object were included in the columns
array you passed into the constructor above
returns a readable object stream that emits search result objects
opts
:
field
- required - which column to search againstquery
- required - the search query string, passed to MATCH
select
- an array of strings to use as the select arguments, e.g. ['foo', 'bar']
tranlates into SELECT foo, bar
. defaults to *
if not specifiedorder
- ORDER BY ?
(default primaryKey)since
- if supplied will put in an AND ? > ?
with [since, primaryKey]
to the querylimit
- LIMIT ?
offset
- OFFSET ?
statement
- optionally you can specify a full SQL statement to run as the query. if specified all other options will be ignoredformatType
- if set to 'object' will format the search response as JSON for streaming. See https://github.com/maxogden/npm-readme-search for an example.