1.2.3 • Published 10 months ago

monolieta-search v1.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Coverage Status

Monolieta-Search

Search library for browser and Node.js

Getting started

Install monolieta-search using yarn or npm

yarn add monolieta-search
npm install monolieta-search

Usage

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

NameTypeDefault
caseSensitivebooleanfalse
exactWordStrategybooleanfalse
ignoreAccentbooleantrue
stopWordObjectnull
unorderedDocumentbooleantrue

Case sensitive

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

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

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

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

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.

1.2.3

10 months ago

1.2.2

10 months ago

1.2.1

10 months ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago