# resort

> Text search over Redis

Latest version **1.0.1** (published 2016-12-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install resort
pnpm add resort
yarn add resort
bun add resort
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-12-30 |
| First published | 2016-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | janneh |
| Maintainers | janneh |
| Keywords | text, search, indexer, redis |

## Links

- npm: https://www.npmjs.com/package/resort
- Repository: https://github.com/janneh/resort
- Homepage: https://github.com/janneh/resort#readme
- Issues: https://github.com/janneh/resort/issues
- npm.io page: https://npm.io/package/resort

## Dependencies (1)

- [redis](https://npm.io/package/redis.md) ^2.6.3

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-12-30
- 1.0.0 — 2016-12-25
- 0.1.0 — 2016-12-13

## README

resort
=====================

## Install

```bash
$ npm install --save resort
```

## Usage

#### Indexing

```js
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

```js
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`](https://github.com/NodeRedis/node_redis#rediscreateclient) 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`](https://github.com/NodeRedis/node_redis#rediscreateclient) to connect to Redis. Default to host `localhost` and port `6379` if no client option is provided.

---
_Source: https://npm.io/package/resort · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
