Simple Performant Fuzzy Search Library – Microfuzz

Category: Form , Javascript | July 25, 2023
Author:Nozbe
Views Total:87 views
Official Page:Go to website
Last Update:July 25, 2023
License:MIT

Preview:

Simple Performant Fuzzy Search Library – Microfuzz

Description:

Microfuzz is a simple, lightweight, high-performance, framework-agnostic fuzzy search library written in JavaScript/TypeScript.

Features:

  • Perform case-insensitive fuzzy searches
  • Handle Cyrillic, Latin, and basic CJK scripts
  • Search words in any order
  • Get highlighted search matches
  • Customize search strictness
  • Sort results by match accuracy
  • Search in-memory data structures
  • Plug in and start searching in minutes
  • Weighing in at around 2KB gzipped

How to use it:

1. Import the Microfuzz.

import createFuzzySearch from '@nozbe/microfuzz'

2. Apply the fuzzy search functionality to an array or an array of objects:

// array
const list = [/* ... */]
const fuzzySearch = createFuzzySearch(list)
// array of objects
const fuzzySearch = createFuzzySearch(list,{
      // search by `name` property
      key: 'name',
      // search by `description.text` property
      getText: (item) => [item.description.text]
      // search by multiple properties:
      getText: (item) => [item.name, item.description.text]
})
// get results
const results = fuzzySearch(queryText)

You Might Be Interested In:


Leave a Reply