New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

resort

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resort

Text search over Redis

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

resort

Install

$ npm install --save resort

Usage

Indexing
import { createIndexer } from 'resort'

const indexer = createIndexer({ key: 'myIndex' })

const data = [
  { id: 'a', content: 'When you were here before' },
  { id: 'b', content: 'Could not look you in the eye' },
  { id: 'c', content: 'You are just like an angel' }
  { id: 'd', content: 'Your skin makes me cry' }
]

const indexing = data.map(page =>
  indexer.index(page.id, page.content)
)

Promise.all(indexing)
  .then(() => {
    console.log('Indexing complete...')
  })
Searching
import { createSearcher } from 'resort'

const searcher = createSearcher({ key: 'myIndex' })

searcher.search('cry')
  .then(result => {
    console.log('Search results:', result)
  })

API

createIndexer(options)

Returns an indexer with an index(id, content) method on it to be used for indexing.

options

Type: object

key (required)

Type: string

The key under which the index will be available

client

Type: RedisClient

RedisClient to connect to Redis. Default to host localhost and port 6379 if no client option is provided.

filterFn

Type: function(word: String): Boolean

Filter function applied to each words of in the content.

createSearcher(options)
options

Type: object

key (required)

Type: string

The key for the index to search

client

Type: RedisClient

RedisClient to connect to Redis. Default to host localhost and port 6379 if no client option is provided.

Keywords

FAQs

Package last updated on 30 Dec 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc