fuse.js vs fuzzy-search vs fuzzyset
Fuzzy Search Libraries
fuse.jsfuzzy-searchfuzzysetSimilar Packages:
Fuzzy Search Libraries

Fuzzy search libraries in JavaScript provide algorithms to find matches in a dataset that are similar to a given input, even if they are not exact matches. This is useful for applications like autocomplete, search suggestions, and data validation, where user input may contain typos or variations. These libraries use techniques like Levenshtein distance, tokenization, and scoring to rank results based on their similarity to the input, allowing for more flexible and user-friendly search experiences. fuse.js is a powerful, lightweight fuzzy search library that allows for searching through arrays of objects with customizable scoring and matching algorithms. fuzzy-search is a simple and fast fuzzy search library that provides a straightforward API for searching through arrays with minimal configuration. fuzzyset is a unique fuzzy matching library that creates a set of strings and uses a scoring system based on the Levenshtein distance algorithm to find and rank similar strings, making it ideal for applications that require precise control over matching accuracy.

Npm Package Weekly Downloads Trend
3 Years
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
fuse.js5,458,37819,717456 kB1110 months agoApache-2.0
fuzzy-search113,056229-166 years agoISC
fuzzyset19,6421,37835.6 kB14 years agosee LICENSE.md
Feature Comparison: fuse.js vs fuzzy-search vs fuzzyset

Matching Algorithm

  • fuse.js:

    fuse.js uses a combination of tokenization and weighted scoring to match input against a dataset. It allows for partial matches, supports multiple keys, and provides customizable scoring functions to prioritize certain matches over others.

  • fuzzy-search:

    fuzzy-search uses a simple fuzzy matching algorithm that allows for typos and slight variations in the input. It provides a straightforward implementation that prioritizes speed and efficiency while maintaining good accuracy in matching.

  • fuzzyset:

    fuzzyset uses the Levenshtein distance algorithm to calculate the similarity between strings. It creates a set of strings with associated scores, allowing for precise control over how matches are determined and ranked based on their similarity.

Data Structure

  • fuse.js:

    fuse.js is designed to work with arrays of objects, allowing you to specify which keys to search within each object. This makes it highly versatile for searching through complex data structures with multiple attributes.

  • fuzzy-search:

    fuzzy-search works with simple arrays of strings or objects. It provides a flexible API for searching through different types of data, but it does not require any specific structure, making it easy to integrate into various projects.

  • fuzzyset:

    fuzzyset is focused on working with a set of strings. It requires you to create a fuzzy set by adding strings to it, after which you can perform fuzzy searches and retrieve matches along with their similarity scores.

Customization

  • fuse.js:

    fuse.js offers extensive customization options, including the ability to define multiple search keys, set weights for different keys, customize the tokenization process, and define your own scoring functions. This makes it highly adaptable to different use cases and data structures.

  • fuzzy-search:

    fuzzy-search provides limited customization, focusing on simplicity and ease of use. It allows you to configure the fuzziness level and specify which keys to search, but it does not offer as much flexibility as fuse.js.

  • fuzzyset:

    fuzzyset allows for some customization in terms of how strings are added to the set and how matches are scored. However, it is more focused on providing a clear and efficient fuzzy matching process rather than offering extensive configuration options.

Performance

  • fuse.js:

    fuse.js is optimized for performance, but its complexity and the ability to handle large datasets with multiple keys can lead to slower search times compared to simpler algorithms. Performance can be improved by limiting the number of search keys and using weighted scoring to prioritize matches.

  • fuzzy-search:

    fuzzy-search is designed for fast fuzzy searching, making it suitable for applications where performance is critical. Its lightweight implementation ensures quick search times, even with larger datasets, while maintaining good accuracy.

  • fuzzyset:

    fuzzyset performance depends on the size of the string set and the complexity of the Levenshtein distance calculations. While it is efficient for smaller sets, performance may degrade with very large datasets due to the computational cost of calculating similarity scores.

Ease of Use: Code Examples

  • fuse.js:

    Fuzzy search with fuse.js

    import Fuse from 'fuse.js';
    
    const data = [
      { name: 'Alice', age: 25 },
      { name: 'Bob', age: 30 },
      { name: 'Charlie', age: 35 },
    ];
    
    const fuse = new Fuse(data, {
      keys: ['name'], // Specify the keys to search
      threshold: 0.3, // Set the fuzziness level
    });
    
    const result = fuse.search('Alic'); // Search for a fuzzy match
    console.log(result);
    
  • fuzzy-search:

    Fuzzy search with fuzzy-search

    import { fuzzySearch } from 'fuzzy-search';
    
    const data = ['apple', 'banana', 'orange', 'grape'];
    const searchTerm = 'appl';
    const results = fuzzySearch(data, searchTerm);
    console.log(results); // ['apple', 'grape']
    
  • fuzzyset:

    Fuzzy search with fuzzyset

    import FuzzySet from 'fuzzyset';
    
    const fuzzySet = FuzzySet();
    fuzzySet.add('apple');
    fuzzySet.add('banana');
    fuzzySet.add('orange');
    
    const results = fuzzySet.get('appl'); // Get fuzzy matches for 'appl'
    console.log(results);
    
How to Choose: fuse.js vs fuzzy-search vs fuzzyset
  • fuse.js:

    Choose fuse.js if you need a feature-rich fuzzy search library that supports searching through complex data structures (like arrays of objects) with customizable scoring, multiple search keys, and advanced options like tokenization and weighting. It is ideal for applications that require high accuracy and flexibility in search results.

  • fuzzy-search:

    Choose fuzzy-search if you want a lightweight and fast fuzzy search solution with a simple API. It is best for projects where performance is critical and you need a no-frills library that provides good fuzzy matching without a lot of configuration or overhead.

  • fuzzyset:

    Choose fuzzyset if you need a library that focuses on fuzzy matching with a scoring system based on Levenshtein distance. It is suitable for applications that require precise control over matching accuracy and want to work with a set of strings rather than searching through complex data structures.

README for fuse.js

Fuse.js

Node.js CI Version Downloads code style: prettier Contributors License

Supporting Fuse.js

Through contributions, donations, and sponsorship, you allow Fuse.js to thrive. Also, you will be recognized as a beacon of support to open-source developers.


Sponsors


Introduction

Fuse.js is a lightweight fuzzy-search, in JavaScript, with zero dependencies.

Browser Compatibility

Fuse.js supports all browsers that are ES5-compliant (IE8 and below are not supported).

Documentation

To check out a live demo and docs, visit fusejs.io.

Develop

Here's a separate document for developers.

Contribute

We've set up a separate document for our contribution guidelines.