Fix some bugs with profile search

This commit is contained in:
Jon Staab
2025-05-12 10:00:09 -07:00
parent 62ff63c240
commit ca155eb735
4 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@welshman/app",
"version": "0.2.4",
"version": "0.2.5",
"author": "hodlbod",
"license": "MIT",
"description": "A collection of svelte stores for use in building nostr client applications.",
+4 -6
View File
@@ -1,12 +1,12 @@
import Fuse, {IFuseOptions, FuseResult} from "fuse.js"
import {debounce} from "throttle-debounce"
import {derived} from "svelte/store"
import {dec, sortBy} from "@welshman/lib"
import {dec, inc, sortBy} from "@welshman/lib"
import {PROFILE, PublishedProfile} from "@welshman/util"
import {load} from "@welshman/net"
import {throttled} from "@welshman/store"
import {Router} from "@welshman/router"
import {wotGraph} from "./wot.js"
import {wotGraph, maxWot} from "./wot.js"
import {profiles} from "./profiles.js"
import {topics, Topic} from "./topics.js"
import {relays, Relay} from "./relays.js"
@@ -74,12 +74,10 @@ export const profileSearch = derived(
return createSearch(options, {
onSearch: searchProfiles,
getValue: (profile: PublishedProfile) => profile.event.pubkey,
sortFn: ({score, item}) => {
if (score && score > 0.1) return -score!
sortFn: ({score = 1, item}) => {
const wotScore = wotGraph.get().get(item.event.pubkey) || 0
return score ? dec(score) * wotScore : -wotScore
return dec(score) * inc(wotScore / maxWot.get())
},
fuseOptions: {
keys: [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@welshman/editor",
"version": "0.2.1",
"version": "0.2.2",
"author": "hodlbod",
"license": "MIT",
"description": "A batteries-included nostr editor.",
@@ -67,6 +67,7 @@ export class DefaultSuggestionsWrapper implements ISuggestionsWrapper {
const {term, search} = this.props
this.items = search(term).slice(0, 5)
this.render()
})
render() {