From b14b831ba82232850dfae1722ad26bb3e0b23871 Mon Sep 17 00:00:00 2001 From: Kevin Schaal Date: Sat, 17 Feb 2024 17:14:35 +0100 Subject: [PATCH 1/4] fix(demo): fill matches table for more than 10 matches --- demo/fuzzy-demo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/fuzzy-demo.js b/demo/fuzzy-demo.js index e59c7d5..e53042a 100644 --- a/demo/fuzzy-demo.js +++ b/demo/fuzzy-demo.js @@ -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); From 580e8cec95e6840296c4fca18f7190c7ed698a90 Mon Sep 17 00:00:00 2001 From: Kevin Schaal Date: Sat, 17 Feb 2024 17:16:42 +0100 Subject: [PATCH 2/4] docs: fix topN docstring --- src/interfaces/query.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interfaces/query.ts b/src/interfaces/query.ts index 8471d52..65b798b 100644 --- a/src/interfaces/query.ts +++ b/src/interfaces/query.ts @@ -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; From 3da3db8ea275e124dbd8b093a594b1121d428900 Mon Sep 17 00:00:00 2001 From: Kevin Schaal Date: Sat, 17 Feb 2024 17:31:32 +0100 Subject: [PATCH 3/4] docs: add description of the query parameters --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index 1d9cf0d..1ab3cd0 100644 --- a/readme.md +++ b/readme.md @@ -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 From 94be10fc8ac763227f2757fe3010483c3060a6ee Mon Sep 17 00:00:00 2001 From: Kevin Schaal Date: Sat, 17 Feb 2024 19:30:31 +0100 Subject: [PATCH 4/4] chore(package): bump version to 1.0.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 91f379d..4fb0182 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@m31coding/fuzzy-search", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@m31coding/fuzzy-search", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "devDependencies": { "@faker-js/faker": "^8.3.1", diff --git a/package.json b/package.json index 8bc4fe9..c39fd97 100644 --- a/package.json +++ b/package.json @@ -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",