# monolieta-search

> Search library for browser and Node.js

Latest version **1.2.3** (published 2023-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install monolieta-search
pnpm add monolieta-search
yarn add monolieta-search
bun add monolieta-search
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2023-07-14 |
| First published | 2021-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.x |
| Dependencies | 0 |
| Unpacked size | 18.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jonattan Velásquez |
| Maintainers | jonattan |
| Keywords | search, performance, indexing |

## Links

- npm: https://www.npmjs.com/package/monolieta-search
- Repository: https://github.com/jonattanva/monolieta-search
- Homepage: https://github.com/jonattanva/monolieta-search#readme
- Issues: https://github.com/jonattanva/monolieta-search/issues
- npm.io page: https://npm.io/package/monolieta-search

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.3 (latest) — 2023-07-14
- 1.2.2 — 2023-07-14
- 1.2.1 — 2023-07-13
- 1.2.0 — 2022-03-03
- 1.1.1 — 2021-12-20
- 1.1.0 — 2021-12-20
- 1.0.2 — 2021-11-10
- 1.0.1 — 2021-11-10
- 1.0.0 — 2021-11-04

## README

[![Coverage Status](https://coveralls.io/repos/github/jonattanva/monolieta-search/badge.svg?branch=main)](https://coveralls.io/github/jonattanva/monolieta-search?branch=main)

# Monolieta-Search

Search library for browser and Node.js

## Getting started

Install `monolieta-search` using yarn or npm

```shell
yarn add monolieta-search
```

```shell
npm install monolieta-search
```

## Usage

```js
import { Search } from 'monolieta-search';

const client = new Search();
client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search('the hobbit'); // ["002", "001"]
```

## Setting

| Name              | Type    | Default |
| ----------------- | ------- | :-----: |
| caseSensitive     | boolean |  false  |
| exactWordStrategy | boolean |  false  |
| ignoreAccent      | boolean |  true   |
| stopWord          | Object  |  null   |
| unorderedDocument | boolean |  true   |

## Case sensitive

```js
const client = new Search({
    caseSensitive: true
});

client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search('hobbit'); // []
client.search('Hobbit'); // ["002"]
```

## Exact word strategy

```js
const client = new Search({
    exactWordStrategy: true
});

client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search('o'); // []
client.search('Rings'); // ["001"]
```

## Ignore accent

```js
const client = new Search({
    ignoreAccent: false
});

client.index('001', 'Parásitos');
client.index('002', 'Déjame salir');
client.index('003', 'El Tiburón');

client.search('Tiburon'); // []
client.search('Tiburón'); // ["003"]
```

## Stop word

```js
const client = new Search({
    stopWord: {
        the: true
    }
});

client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search('the'); // []
client.search('the hobbit'); // ["002"]
```

## Unordered document

```js
const client = new Search({
    unorderedDocument: false
});

client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search('the'); // ["001", "002"]
client.search('the hobbit'); // ["002", "001"]
```

## License

This project is licensed under the MIT License.

---
_Source: https://npm.io/package/monolieta-search · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
