MiniSearch

Tiny and powerful JavaScript full-text search engine for browser and Node

README

MiniSearch

CI Build Coverage Status Minzipped Size npm npm downloads types

MiniSearch is a tiny but powerful in-memory fulltext search engine written in
JavaScript. It is respectful of resources, and it can comfortably run both in
Node and in the browser.

Try out the demo application.

Find the complete [documentation and API reference
here](https://lucaong.github.io/minisearch/classes/_minisearch_.minisearch.html),
and more background about MiniSearch, including a comparison with other
similar libraries, in [this blog
post](https://lucaongaro.eu/blog/2019/01/30/minisearch-client-side-fulltext-search-engine.html).

MiniSearch follows semantic versioning,
and documents releases and changes in the


Use case


MiniSearch addresses use cases where full-text search features are needed
(e.g. prefix search, fuzzy search, ranking, boosting of fields…), but the data
to be indexed can fit locally in the process memory. While you won't index the
whole Internet with it, there are surprisingly many use cases that are served
well by MiniSearch. By storing the index in local memory, MiniSearch can
work offline, and can process queries quickly, without network latency.

A prominent use-case is real time search "as you type" in web and mobile
applications, where keeping the index on the client enables fast and reactive
UIs, removing the need to make requests to a search server.


Features


  Memory-efficient index, designed to support memory-constrained use cases
    like mobile browsers.

  Exact match, prefix search, fuzzy match, field boosting.

  Auto-suggestion engine, for auto-completion of search queries.

  Modern search result ranking algorithm.

  Documents can be added and removed from the index at any time.

  Zero external dependencies.

MiniSearch strives to expose a simple API that provides the building blocks to
build custom solutions, while keeping a small and well tested codebase.


Installation


With npm:

  1. ```
  2. npm install --save minisearch
  3. ```

With yarn:

  1. ```
  2. yarn add minisearch
  3. ```

Then require or import it in your project:

  1. ``` js
  2. // If you are using import:
  3. import MiniSearch from 'minisearch'

  4. // If you are using require:
  5. const MiniSearch = require('minisearch')
  6. ```

Alternatively, if you prefer to use a `