Socket
Socket
Sign inDemoInstall

@clocklimited/cf-text-search

Package Overview
Dependencies
1
Maintainers
5
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @clocklimited/cf-text-search

Add full-text search functionality onto cf services


Version published
Weekly downloads
113
increased by98.25%
Maintainers
5
Created
Weekly downloads
 

Readme

Source

Add 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/.

Installation

npm install cf-text-search

Usage

var textSearch = require('cf-text-search')

service.search = textSearch(service)

service.search('my search terms', function (err, results) {})

var search = textSearch(service)

  • service is a crud-service

search(searchTerms, query={}, options={}, cb)

  • searchTerms - a string which gets pass through to mongo's full text search, can be an array of strings
  • query - optional, an additional object query to filter the results
  • options - optional, any search options e.g. skip, limit
  • cb - the callback function, gets called with (err, results)

Score

The score 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.

Credits

Built by developers at Clock.

Licence

Licensed under the New BSD License

FAQs

Last updated on 08 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc