Add full-text search functionality onto cf services
npm install @clocklimited/cf-text-searchAdd full-text search functionality onto cf services. Uses mongo's full text search functionality. Requires Mongo v2.6+.
Modifies the passed in query, adding the $text property as per http://docs.mongodb.org/manual/reference/operator/query/text/.
```
npm install cf-text-search
`js
var textSearch = require('cf-text-search')
service.search = textSearch(service)
service.search('my search terms', function (err, results) {})
`
- service is a crud-service
- searchTerms - a string which gets pass through to mongo's full text search, can be an array of stringsquery
- - optional, an additional object query to filter the resultsoptions
- - optional, any search options e.g. skip, limitcb
- - the callback function, gets called with (err, results)
of the document is returned on all documents as described here:
http://docs.mongodb.org/manual/reference/operator/projection/meta/.If using in conjunction with schemata, you'll need to add a
score` property to your schema so that it doesn't get stripped out.