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

redisearchfuzzy

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redisearchfuzzy

Simple Node Interface for RediSearch indexes. Implemented for RediSearch 2.x

  • 0.0.2-8
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
344
decreased by-1.43%
Maintainers
1
Weekly downloads
 
Created
Source

RediSearchFuzzy Build Status

Simple Node Interface for RediSearch indexes. Implemented for RediSearch 2.x

Description

This library was created as an interface for RediSearch 2+ version for Nodejs. It provides a simple Node API to create, remove and interact with RediSearch's Secondary Indexing. It also provides an additional functionality for Searching with Fuzzy strings. This library uses Promises and therefore supports ES6 async implementation over callbacks.

Please note, that this library does not contain ALL of RediSearch features and thus contributions are welcome.

Installation

npm install redisearchfuzzy

Getting started

Initiating the RediSearchFuzzy Client and passing existing Redis Client to it:

const myRedisClient = require("redis").createClient();
const { RediSearchFuzzy } = require("redisearchfuzzy");
const RedisFuzzy = new RediSearchFuzzy(myRedisClient);

Now we can call the functions from RedisFuzzy instance.

const INDEX_NAME = "PRODUCTS";

RedisFuzzy.createIndexList({
    indexName: INDEX_NAME,
    schema: [{ field: "title" }, { field: "body" }],
    options: ["PAYLOAD_FIELD", "myPayload"],
});

RedisFuzzy.addDocument("product:1", {
    title: "My favorite zebra",
    body: "A zebra's dazzling stripes make them among the most recognisable mammals",
    myPayload: `{ data: "hello1" }`,
});

RedisFuzzy.addDocument("product:2", {
    title: "My favorite snake cobra",
    body: "Venomous and many are capable of rearing upwards and producing a hood when threatened",
    myPayload: `{ data: "hello2" }`,
});

// Search in our index:
const searchIndex = async () => {
    // with Fuzzy option
    const resultFuzzy = await Fuzzy.searchDocuments({ indexName: INDEX_NAME, query: "Venom", useFuzzy: true });
    // without Fuzzy option
    const result = await Fuzzy.searchDocuments({ indexName: INDEX_NAME, query: "Venom" });
};

searchIndex();

API

RediSearchFuzzy instance contains:

FAQs

Package last updated on 17 Jan 2021

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