# rtrie

> Trie based search for autocompletes with Redis.

Latest version **0.0.0** (published 2013-10-29) · BSD license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2013-10-29 |
| First published | 2013-10-29 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Rodrigo Navarro |
| Maintainers | reu |
| Keywords | autocomplete, auto-complete, completer, redis, trie |

## Links

- npm: https://www.npmjs.com/package/rtrie
- Repository: https://github.com/reu/rtrie
- npm.io page: https://npm.io/package/rtrie

## Dependencies (2)

- [iconv](https://npm.io/package/iconv.md) *
- [redis](https://npm.io/package/redis.md) *

## 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

- 0.0.0 (latest) — 2013-10-29

## README

# Rtrie

Trie based autocomplete with Redis.

## Usage

```javascript
var Rtrie = require("rtrie"),
    cities = new Rtrie("cities");

// index(term, id[, metadata, priority])
cities.index("Campinas", 1, { state: "SP", population: 1000000 }, 10);
cities.index("Americana", 2, { state: "SP", population: 250000 });
cities.index("Santa Bárbara D'Oeste", 3, { state: "SP", population: 190000 });
cities.index("Campina Grande", 4, { state: "PB", population: 20000 });

// search(term, callback)
cities.search("Campin", function(id, term, data) {
  // will call with "Campinas" first because of the priority:
  // [1, "Campinas", { state: "SP", population: 1000000 }]
  // [4, "Campina Grande", { state: "PB", population: 20000 }]
});

You can also specify a limit for the search function:
var limit = 1;
cities.search("Campin", limit, function(id, term, data) {
  // will call with:
  // [1, "Campinas", { state: "SP", population: 1000000 }]
});

You may also creat a totally different item type database:
var names = new Rtrie("names");

names.index("Rodrigo", 1, { age: 27 });
names.index("Gustavo", 2, { age: 16 });
names.index("Frederico", 3, { age: 30 });
```

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