@dumbjs/search
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@dumbjs/search

Unified Search Adaptor Model for various databases.

[!NOTE] The library is still being developed, please only use it for beta testing and not on a productino project.

Usage

Install the library

npm i --save @dumbjs/search

Initialize a Collection Model

import { SearchCollection } from "@dumbjs/search";
import { RedisAdapter } from "@dumbjs/search/redis";

const collection = new SearchCollection({
  adapter: new RedisAdapter("UserSearch", {
    redis: client,
    name: "user-search",
  }),
});

// add in the required strings with the search terms string

await collection.set(1, "Foo");
await collection.set(2, "Foo Bar");
await collection.set(3, "Foo Bar Baz");

const result = await collection.search("Bar"); //=> [2,3]

Credits

  • tj/reds for the original implementation
  • antirez for the more string prefix based solution

Readme

Keywords

none

Package Sidebar

Install

npm i @dumbjs/search

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

29 kB

Total Files

29

Last publish

Collaborators

  • barelyreaper