Installation
Quick Take
Purpose
Search programs such as fuse.js
work on a set of data, for example, it’s this list
argument below:
const options = {
keys: ["title", "author.firstName"],
};
const fuse = new Fuse(list, options);
// Change the pattern
const pattern = "";
return fuse.search(pattern);
What if you want to implement a search function which would search within large strings, let’s say blog articles?
It would be inefficient to bundle up raw article string, send it to user’s browser, initiate fuse.js
there and perform a search.
It’s better to pre-format the sources — search function does not care about words present more than once; it does not care about letter case or article words.
This program prepares optimised strings to be consumed by the likes of fuse.js
.
PS. Also, you might want to pre-index the list, to speed up the search, but that’s a separate thing.
API — extract()
The main function extract()
is imported like this:
It’s a function which takes one input argument:
Input argument | Type | Obligatory | Description |
---|---|---|---|
str Type: String Obligatory: yes | |||
str | String | yes | String which we will process |
This function will return a string.
API — version
You can import version
: