Skip to content

Commit

Permalink
fix(demo), docs: Update readme, minor demo fix, and version bump to 1…
Browse files Browse the repository at this point in the history
….0.1 (#5)

* fix(demo): fill matches table for more than 10 matches

* docs: fix topN docstring

* docs: add description of the query parameters

* chore(package): bump version to 1.0.1
  • Loading branch information
m31coding authored Feb 17, 2024
1 parent ccc4e81 commit c688936
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion demo/fuzzy-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ function renderMatches(matches, searchDataConfig) {
}

function fillTableWithMatches(matches, searchDataConfig) {
for (let i = 0; i < matches.length; i++) {
for (let i = 0; i < Math.min(matches.length, 10); i++) {
let row = tableBody.children[i];
row.match = matches[i];
row.children[1].textContent = searchDataConfig.getEntityString(matches[i].entity);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@m31coding/fuzzy-search",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"description": "A fast, accurate and multilingual fuzzy search library.",
"homepage": "https://github.com/m31coding/fuzzy-search",
Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ console.dir(result2);
} */
```

The following parameters are available when creating a query:

| Parameter | Type | Default | Description |
| --------- | ---- | ------- | ----------- |
| string | string | - | The query string. |
| topN | number | 10 | The maximum number of matches to return. Provide Infinity to return all matches. |
| minQuality | number | 0.3 | The minimum quality of a match, ranging from 0 to 1. When set to zero, all terms that share at least one common n-gram with the query are considered a match. |

If the data terms contain characters and strings in non-latin scripts (such as Arabic, Cyrillic, Greek, Han, ... see also [ISO 15924](https://en.wikipedia.org/wiki/ISO_15924)), the default configuration must be adjusted before creating the searcher:

```js
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class Query {
public readonly string: string;

/**
* The maximum number of matches to return. If undefined, all matches will be returned.
* The maximum number of matches to return. Provide Infinity to return all matches.
*/
public readonly topN: number;

Expand Down

0 comments on commit c688936

Please sign in to comment.