1.0.2 • Published 2 years ago

search-engine-query-client v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Using this package to consume your search engine

  • Install the package by running
    npm i search-engine-query-client
  • Ensure that your Search Engine is running and you have its url

Prerequisites

  • A url to where your Engine is running
  • The searchIndex to which you want to store your data or query from

Using the Package to make queries to your Search Engine

  • In the example below
  • http://localhost:2357 is my parent url where my search engine is running
  • movies is my search index
  • The json object in the tryAddData is my sample data am adding for it to be searchable
  • Gun is my sample search query
import { addSearchableData, searchData } from ("search-engine-query-client");

const tryAddData = async () => {
  await addSearchableData("http://localhost:2357/add", "movies", {
    id: 2,
    title: "Smoking Gun",
  }).then((res) => console.log(res));
};

tryAddData();

const tryGetData = async () => {
  await searchData("http://localhost:2357/search", "movies", "Gun").then(
    (res) => console.log(res)
  );
};

tryGetData();