Full text search based on InvertedIndex and ordinary approach

Overview

Full text search based on InvertedIndex and ordinary approach.

Summary

This project has CRUD operation on Contact data.

Each contact has firstName, lastName and phoneNumber.

MongoDB is used to store contact data and Redis to store InvertedIndex. On each CRUD operation, the InvertedIndex gets updated.

The Important part of this project is how to fetch data. There are two methods to get contact data based on InvertedIndex or Ordinary approach.

In the ordinary method, it loops over all contact data and returns all matched records.

With InvertedIndex, first lowercase each contact data(like firstName) and split them by " " then add all prefixes of each member of this array that has more than or equal to 3 lengths as key to Redis Set which their values are their ContactIDs.

When a query comes in, first lowercase query and split that by " " then Intersect all sets which have these keys. The result is all contact that has words that start with query words.

Below is the comparison between these two methods' performance

comparison

As you see above at first, it creates 1000 contacts that take 13.3 seconds (13.3 ms per request).

Then it requests 1000 times with the InvertedIndex approach that takes 12.6 seconds (12.6 ms per request). And finally, it tests the ordinary method that takes 44.1 seconds (44.1 ms per request).

The InvertedIndex method is nearly 3.5 faster than ordinary search.

How to run API

At first, dependencies should be installed by:

npm i

Then activate MongoDB by:

mongod

Then you can run the API by:

npm run dev

Also to test API run:

npm run test

API documentation is available at localhost:5000/api-docs

Note: To run API, Redis-Server and MongoDB must be installed before. Also .env.test file should be renamed to .env.

You might also like...

Instant spotlight like search and actions in your browser with Sugu Search.

Instant spotlight like search and actions in your browser with Sugu Search.

Sugu Search Instant spotlight like search and actions in your browser with Sugu Search. Developed by Drew Hutton Grab it today for Firefox and Chrome

Oct 12, 2022

An efficient (and the fastest!) way to search the web privately using Brave Search Engine

Brave Search An efficient (and the fastest) way to search the web privately using Brave Search Engine. Not affiliated with Brave Search. Tested on Chr

Jun 2, 2022

๐Ÿญ search-buddy ultra lightweight javascript plugin that can help you create instant search and/or facilitate navigation between pages.

๐Ÿญ search-buddy ultra lightweight javascript plugin that can help you create instant search and/or facilitate navigation between pages.

๐Ÿญ search-buddy search-buddy is an openโ€‘source ultra lightweight javascript plugin (* 1kb). It can help you create instant search and/or facilitate n

Jun 16, 2022

๐ŸŸข Music player app with a modern homepage, fully-fledged music player, search, lyrics, song exploration features, search, popular music around you, worldwide top charts, and much more.

๐ŸŸข Music player app with a modern homepage, fully-fledged music player, search, lyrics, song exploration features, search, popular music around you, worldwide top charts, and much more.

Music-player-app see the project here. 1. Key Features 2. Technologies I've used Key Features: ๐ŸŸข Fully responsive clean UI. ๐ŸŸข Entirely mobile respo

Nov 16, 2022

Tesodev-search-app - Personal Search App with React-Hooks

Tesodev-search-app - Personal Search App with React-Hooks

Tesodev-search-app Personal Search App with React-Hooks View on Heroku : [https://tesodev-staff-search-app.herokuapp.com/] Instructions Clone this rep

Nov 10, 2022

Node starter kit for semantic-search. Uses Mighty Inference Server with Qdrant vector search.

Node starter kit for semantic-search.  Uses Mighty Inference Server with Qdrant vector search.

Mighty Starter This project provides a complete and working semantic search application, using Mighty Inference Server, Qdrant Vector Search, and an e

Oct 18, 2022

Allows users to quickly search highlighted items on Wikipedia. Inspired by the "search Wikipedia" function on the kindle mobile app.

Allows users to quickly search highlighted items on Wikipedia. Inspired by the

wikipedia-search Allows users to quickly search highlighted items on Wikipedia. Inspired by the "search Wikipedia" function on the kindle mobile app.

Aug 15, 2022

A plugin for Obsidian (https://obsidian.md) that adds a button to its search view for copying the Obsidian search URL.

A plugin for Obsidian (https://obsidian.md) that adds a button to its search view for copying the Obsidian search URL.

Copy Search URL This plugin adds a button to Obsidian's search view. Clicking it will copy the Obsidian URL for the current search to the clipboard. T

Dec 26, 2022

Search for food, recepies, and full detailed information on how to prepare them.

Search for food, recepies, and full detailed information on how to prepare them.

Foodipy | JavaScript Capstone This is a group project being built in our second module of our curriculum at microverse. its a web application for list

Mar 24, 2022
Owner
Ali Nowrouzi
Ali Nowrouzi
"Rectilearn" a tool to make studying less ordinary

This is the repo for the TWT codejam 2022 https://rectilearn.vercel.app/ by Team Rectifiers Our Goal To create a website which helps people to study b

null 4 Jun 28, 2022
"Jira Search Helper" is a project to search more detail view and support highlight than original jira search

Jira Search Helper What is Jira Search Helper? "Jira Search Helper" is a project to search more detail view and support highlight than original jira s

null 41 Dec 23, 2022
Tiny and powerful JavaScript full-text search engine for browser and Node

MiniSearch MiniSearch is a tiny but powerful in-memory fulltext search engine written in JavaScript. It is respectful of resources, and it can comfort

Luca Ongaro 2k Jan 3, 2023
Adds full-text search to Community Solid Server. Powered by atomic-server

Solid Search for Community Solid Server This is an extension / plugin for the Community Solid Server. It adds full-text search to the Community Solid

Ontola 4 Jun 6, 2022
๐ŸŒŒ Fast, in-memory, full-text search engine written in TypeScript. Now in beta.

Installation You can install Lyra using npm, yarn, pnpm: npm i @nearform/lyra yarn add @nearform/lyra pnpm add @nearform/lyra Usage Lyra is quite simp

NearForm 5.1k Dec 30, 2022
A personal semantic search engine capable of surfacing relevant bookmarks, journal entries, notes, blogs, contacts, and more, built on an efficient document embedding algorithm and Monocle's personal search index.

Revery ?? Revery is a semantic search engine that operates on my Monocle search index. While Revery lets me search through the same database of tens o

Linus Lee 215 Dec 30, 2022
A RESP 'Redis Serialization Protocol' library implementation to generate a server, uses a similar approach to express to define you serer, making it easy and fast.

RESPRESS A RESP 'Redis Serialization Protocol' library implementation to generate a server, uses a similar approach to express to define you serer, ma

Yousef Wadi 9 Aug 29, 2022
A novel approach for security and user experience of Graphical Password Authentication.

Graphical Password Authentication Alohomora Harry Potter themed (not really) Graphical Password Authentication Flowchart and Architecture Solution Dem

Akshat Shah 10 Dec 15, 2022
Modern approach to Low Quality Image Placeholders (LQIP) using webp and sharp.

lqip-modern Modern approach to Low Quality Image Placeholders (LQIP) using webp and sharp. (demo) This approach is extremely fast and produces much sm

Travis Fischer 187 Dec 30, 2022