lunr vs flexsearch vs js-search vs elasticlunr vs fuse.js vs search-index
JavaScript Search Libraries
lunrflexsearchjs-searchelasticlunrfuse.jssearch-indexSimilar Packages:

JavaScript Search Libraries

JavaScript search libraries are designed to provide efficient and flexible search capabilities within web applications. They allow developers to implement full-text search functionality, enabling users to quickly find relevant information from large datasets. These libraries vary in terms of features, performance, and ease of use, making it essential to choose the right one based on specific project requirements.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
lunr4,690,9999,214-1296 years agoMIT
flexsearch760,50313,6422.33 MB306 months agoApache-2.0
js-search77,5432,229117 kB83 years agoMIT
elasticlunr25,2232,076-7710 years agoMIT
fuse.js020,039456 kB7a year agoApache-2.0
search-index01,425693 kB5a year agoMIT

Feature Comparison: lunr vs flexsearch vs js-search vs elasticlunr vs fuse.js vs search-index

Search Algorithm

  • lunr:

    Lunr creates an inverted index for efficient full-text search. It allows for complex queries and supports features like stemming and scoring, providing a good balance between performance and functionality for static sites.

  • flexsearch:

    FlexSearch employs a highly optimized algorithm that combines various techniques like tokenization, indexing, and scoring to deliver lightning-fast search results, even with large datasets. It supports advanced features like multi-language indexing and custom scoring functions.

  • js-search:

    js-search utilizes a basic linear search algorithm, which is straightforward but may not be as efficient for larger datasets. It indexes data in a simple way, making it easy to understand but potentially slower compared to more advanced libraries.

  • elasticlunr:

    ElasticLunr uses a simple inverted index structure to provide fast search capabilities. It mimics Elasticsearch's functionality, allowing for efficient querying and scoring of results based on term frequency and document frequency.

  • fuse.js:

    Fuse.js implements a fuzzy search algorithm that allows for approximate matching, making it resilient to user input errors. It uses a scoring system to rank results based on their relevance to the search query, enhancing user experience.

  • search-index:

    Search Index combines various indexing techniques to provide real-time search capabilities. It supports complex queries and updates, making it suitable for applications that require dynamic data handling.

Ease of Use

  • lunr:

    Lunr is relatively easy to use, with clear documentation and examples. It provides a good balance of features without overwhelming complexity, making it accessible for most developers.

  • flexsearch:

    FlexSearch, while powerful, may require a bit more understanding of its advanced features. However, its documentation is comprehensive, helping developers get started quickly with performance optimization in mind.

  • js-search:

    js-search is extremely easy to use, with a simple API that allows for quick setup. It's ideal for developers looking for a no-fuss search solution without advanced features.

  • elasticlunr:

    ElasticLunr is designed for simplicity and ease of integration. Its API is intuitive, making it easy for developers to implement search functionality without extensive configuration or setup.

  • fuse.js:

    Fuse.js is very user-friendly, with a straightforward API that allows developers to implement fuzzy search with minimal effort. Its configuration options are clear, making it easy to customize search behavior.

  • search-index:

    Search Index may have a steeper learning curve due to its advanced features and configurations. However, its flexibility and power make it worthwhile for complex applications.

Performance

  • lunr:

    Lunr provides good performance for static sites and smaller datasets. However, it may not scale as well with very large datasets compared to more optimized libraries.

  • flexsearch:

    FlexSearch is optimized for speed, capable of handling large datasets efficiently. Its performance is one of its key strengths, making it suitable for applications requiring quick search responses.

  • js-search:

    js-search may not be the fastest option for large datasets due to its linear search approach. It's best for smaller datasets where simplicity and ease of use are prioritized over speed.

  • elasticlunr:

    ElasticLunr performs well for small to medium datasets, but may experience slower performance with larger datasets due to its reliance on client-side processing and indexing.

  • fuse.js:

    Fuse.js performs well for small to medium datasets, but its fuzzy search capabilities can introduce some performance overhead. It's best suited for applications where user input may vary significantly.

  • search-index:

    Search Index is designed for performance, supporting real-time updates and complex queries efficiently. It's suitable for applications that require fast and responsive search capabilities.

Indexing Capabilities

  • lunr:

    Lunr supports full-text indexing and provides features like stemming and stop word filtering. It's effective for static sites needing robust search capabilities without server-side dependencies.

  • flexsearch:

    FlexSearch offers advanced indexing capabilities, including multi-language support and customizable tokenization. It allows for efficient indexing of large datasets with minimal configuration.

  • js-search:

    js-search provides basic indexing capabilities, making it easy to set up but lacking in advanced features. It's best for simple use cases where complex indexing is not required.

  • elasticlunr:

    ElasticLunr allows for easy indexing of documents with a straightforward API. It supports basic indexing features but may lack some advanced capabilities found in server-side solutions.

  • fuse.js:

    Fuse.js requires a manual setup for indexing, but it provides flexibility in how data is indexed. It's suitable for applications where developers want control over the indexing process.

  • search-index:

    Search Index offers advanced indexing features, including real-time updates and complex query handling. It's suitable for applications that require dynamic data indexing and search capabilities.

Community and Support

  • lunr:

    Lunr has a well-established community and good documentation, making it easy for developers to find help and resources for implementation.

  • flexsearch:

    FlexSearch has an active community and comprehensive documentation, making it easy for developers to find support and examples for implementation.

  • js-search:

    js-search has a smaller community but offers basic documentation. It may not have as many resources available compared to more popular libraries.

  • elasticlunr:

    ElasticLunr has a growing community and decent documentation, providing enough resources for developers to get started and troubleshoot common issues.

  • fuse.js:

    Fuse.js benefits from a strong community and extensive documentation, with many examples available to help developers understand its fuzzy search capabilities.

  • search-index:

    Search Index has a growing community, and while its documentation is improving, it may still have gaps compared to more established libraries.

How to Choose: lunr vs flexsearch vs js-search vs elasticlunr vs fuse.js vs search-index

  • lunr:

    Choose Lunr if you want a full-text search engine that is easy to integrate and provides a good balance between performance and features. It's great for static sites and offers indexing capabilities without requiring a server-side component.

  • flexsearch:

    Opt for FlexSearch when performance is a top priority, especially for large datasets. It offers highly optimized search capabilities with features like scoring and multi-language support, making it suitable for applications requiring fast and accurate search results.

  • js-search:

    Use js-search if you prefer a straightforward, easy-to-understand implementation. It provides basic search functionality and is suitable for smaller projects or when simplicity is key without the need for advanced features.

  • elasticlunr:

    Choose ElasticLunr if you need a lightweight, client-side search solution that mimics Elasticsearch's API. It's ideal for small to medium datasets and provides a simple setup with minimal configuration.

  • fuse.js:

    Select Fuse.js for its fuzzy search capabilities, which allow for typo tolerance and approximate matching. It's perfect for applications where users may not know the exact terms they are searching for, enhancing user experience with intelligent search results.

  • search-index:

    Select Search Index for a more complex search solution that supports both client and server-side environments. It's suitable for applications needing advanced indexing and search features, such as real-time updates and complex queries.

README for lunr

Lunr.js

Join the chat at https://gitter.im/olivernn/lunr.js

Build Status

A bit like Solr, but much smaller and not as bright.

Example

A very simple search index can be created using the following:

var idx = lunr(function () {
  this.field('title')
  this.field('body')

  this.add({
    "title": "Twelfth-Night",
    "body": "If music be the food of love, play on: Give me excess of it…",
    "author": "William Shakespeare",
    "id": "1"
  })
})

Then searching is as simple as:

idx.search("love")

This returns a list of matching documents with a score of how closely they match the search query as well as any associated metadata about the match:

[
  {
    "ref": "1",
    "score": 0.3535533905932737,
    "matchData": {
      "metadata": {
        "love": {
          "body": {}
        }
      }
    }
  }
]

API documentation is available, as well as a full working example.

Description

Lunr.js is a small, full-text search library for use in the browser. It indexes JSON documents and provides a simple search interface for retrieving documents that best match text queries.

Why

For web applications with all their data already sitting in the client, it makes sense to be able to search that data on the client too. It saves adding extra, compacted services on the server. A local search index will be quicker, there is no network overhead, and will remain available and usable even without a network connection.

Installation

Simply include the lunr.js source file in the page that you want to use it. Lunr.js is supported in all modern browsers.

Alternatively an npm package is also available npm install lunr.

Browsers that do not support ES5 will require a JavaScript shim for Lunr to work. You can either use Augment.js, ES5-Shim or any library that patches old browsers to provide an ES5 compatible JavaScript environment.

Features

  • Full text search support for 14 languages
  • Boost terms at query time or boost entire documents at index time
  • Scope searches to specific fields
  • Fuzzy term matching with wildcards or edit distance

Contributing

See the CONTRIBUTING.md file.