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.
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]