Friday, November 14, 2025
HomeLanguagesJavascriptFuzzy Search in JavaScript

Fuzzy Search in JavaScript

Fuzzy searching matches the meaning, not necessarily the precise wording or specified phrases. It performs something the same as full-text search against data to see likely misspellings and approximate string matching. it’s a very powerful tool that takes into consideration the context of the phrase you wish to look.

Fuzzy Search is additionally called as approximate string matching. It’s powerful because often text data is messy. For instance, shorthand and abbreviated text are common in various sorts of data. Additionally, outputs from OCR or voice to text conversions tend to be messy or imperfect. Thus, we want to make the foremost of our data by extrapolating the maximum amount of information as possible.

Fuzzy search is more powerful than exact searching when used for research and investigation. Fuzzy search is very useful when researching unfamiliar, foreign-language, or sophisticated terms, the correct spellings of which don’t seem to be widely known. Fuzzy search can also be used to locate individuals supported incomplete or partially inaccurate identifying information.

Installing the package:

$ npm install --save fuse.js

Example:

Javascript




const Fuse = require('fuse.js')
 
const people = [
    {
        name: "John",
        city: "New York"
    },
    {
        name: "Steve",
        city: "Seattle"
    },
    {
        name: "Bill",
        city: "Omaha"
    }
]
 
const fuse = new Fuse(people, {
    keys: ['name', 'city']
})
 
// Search
const result = fuse.search('jon')
 
console.log(result)


Output:

[ { item: { name: 'John', city: 'New York' }, refIndex: 0 } ]

Some common fuzzy search libraries for JavaScript are:

  • List.js : https://listjs.com/
  • Fuse.js : https://fusejs.io/
  • Fuzzy-search :https://www.npmjs.com/package/fuzzy-search
RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11917 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6837 POSTS0 COMMENTS
Umr Jansen
6839 POSTS0 COMMENTS