Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion desktop/scripts/check-file-sizes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const overrides = new Map([
["src-tauri/src/commands/media.rs", 720], // ffmpeg video transcode + poster frame extraction + run_ffmpeg_with_timeout (find_ffmpeg, is_video_file, transcode_to_mp4, extract_poster_frame, transcode_and_extract_poster) + spawn_blocking wrappers + tests
["src-tauri/src/commands/agents.rs", 881], // remote agent lifecycle routing (local + provider branches) + scope enforcement + persona pack metadata wiring + mcp_toolsets field + NIP-OA auth_tag in deploy payload
["src-tauri/src/commands/messages.rs", 510], // feed multi-query + NIP-50 search + forum thread resolution + thread ref + reactions via REQ
["src-tauri/src/nostr_convert.rs", 870], // 12 Nostr event→model converters (channels, profiles, members, notes, search, agents, relay members) + 20 unit tests
["src-tauri/src/nostr_convert.rs", 1210], // 12 Nostr event→model converters (channels, profiles, members, notes, search, agents, relay members) + filter_and_rank_user_search ranker (latest-kind:0-dedupe before mirroring sprout-db ORDER BY) + 32 unit tests
["src-tauri/src/managed_agents/runtime.rs", 780], // KNOWN_AGENT_BINARIES const + process_belongs_to_us FFI (macOS proc_name + Linux /proc/comm) + terminate_process + start/stop/sync lifecycle + pack persona live-read + login shell PATH augmentation + observer endpoint wiring + git credential helper env injection + sprout-agent mcp_hooks wiring + tests
["src-tauri/src/managed_agents/backend.rs", 530], // provider IPC, validation, discovery, binary resolution + tests
["src/features/huddle/HuddleContext.tsx", 650], // huddle lifecycle context + joinHuddle + connectAndSetupMedia shared helper + activeSpeakers/isReconnecting state + PTT (reusable AudioContext) + TTS subscription + mic level analyser (10fps throttle) + agent pubkey refresh
Expand Down
41 changes: 12 additions & 29 deletions desktop/src-tauri/src/commands/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,17 @@ pub async fn search_users(
return Ok(SearchUsersResponse { users: Vec::new() });
}

// Fetch all kind:0 profiles and filter client-side. The old REST endpoint
// used a DB ILIKE query; this is equivalent for small-to-medium relays.
// NIP-50 search doesn't work well for user lookup because Typesense indexes
// raw JSON content and short names don't tokenize at JSON boundaries.
// Fetch all kind:0 profiles and filter+rank client-side. The old REST
// endpoint used a DB ILIKE query; this is equivalent for small-to-medium
// relays. NIP-50 search doesn't work well for user lookup because
// Typesense indexes raw JSON content and short names don't tokenize at
// JSON boundaries.
//
// Important: we must score *every* matching event before truncating to
// `max`, otherwise relay return order silently hides users whose match
// happens to appear after `max` earlier matches. Ranking lives in
// `nostr_convert::filter_and_rank_user_search` and mirrors the ORDER BY
// in the sprout-db `search_users` SQL.
let events = query_relay(
&state,
&[serde_json::json!({
Expand All @@ -197,31 +204,7 @@ pub async fn search_users(
)
.await?;

let mut users = Vec::new();
for ev in &events {
let pubkey_hex = ev.pubkey.to_hex();
if let Ok(v) = serde_json::from_str::<serde_json::Value>(&ev.content) {
let display_name = v
.get("display_name")
.and_then(|v| v.as_str())
.or_else(|| v.get("name").and_then(|v| v.as_str()))
.unwrap_or("");
let nip05 = v.get("nip05").and_then(|v| v.as_str()).unwrap_or("");

let matches = display_name.to_lowercase().contains(&q)
|| nip05.to_lowercase().contains(&q)
|| pubkey_hex.starts_with(&q);

if matches {
users.push(nostr_convert::user_search_result_from_event(ev));
if users.len() >= max {
break;
}
}
}
}

Ok(SearchUsersResponse { users })
Ok(nostr_convert::filter_and_rank_user_search(&events, &q, max))
}

#[tauri::command]
Expand Down
Loading
Loading