From 9f4c8becd67c46fd591a60b78cffa6024f2c28cc Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 13 Jun 2023 09:18:57 -0700 Subject: [PATCH] Reduce threshold for fuzzy search --- CHANGELOG.md | 1 + src/agent/db.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c46350ec..42849e99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [x] Add support for parsing and displaying lnurl invoices - [x] Add advanced search to feeds with a summary of the filter applied - [x] Improve url parsing +- [x] Reduce threshold for fuzzy search # 0.2.30 diff --git a/src/agent/db.ts b/src/agent/db.ts index 52400283..6ce0ad35 100644 --- a/src/agent/db.ts +++ b/src/agent/db.ts @@ -237,10 +237,13 @@ export const searchPeople = watch("people", t => { $or: [{"kind0.name": {$type: "string"}}, {"kind0.display_name": {$type: "string"}}], }) - return fuzzy(people, {keys: ["kind0.name", "kind0.display_name", "kind0.about", "pubkey"]}) + return fuzzy(people, { + keys: ["kind0.name", "kind0.display_name", "kind0.about", "pubkey"], + threshold: 0.3, + }) }) -export const searchTopics = watch("topics", t => fuzzy(t.all(), {keys: ["name"]})) +export const searchTopics = watch("topics", t => fuzzy(t.all(), {keys: ["name"], threshold: 0.2})) export const searchRelays = watch("relays", t => fuzzy(t.all(), {keys: ["name", "description", "url"]})