From ca821d6e569f5e5b31ebab2cbbec39dae84d218c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 23:22:49 +0000 Subject: [PATCH 1/4] Initial plan From 3392b0c3ab72953b28ebc060cd907ff18813a487 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 23:24:32 +0000 Subject: [PATCH 2/4] Update search spec with improved ranking factors Co-authored-by: wham <448809+wham@users.noreply.github.com> --- main.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/main.md b/main.md index 9280435..50a97d1 100644 --- a/main.md +++ b/main.md @@ -1201,7 +1201,7 @@ Where `` is a comma-separated list of invalid fields, and `180 days): 0.7 #### table:schema_version From eb051e97ebe5ecd65009304718e9fb96aa4ccc69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 23:26:01 +0000 Subject: [PATCH 3/4] Address code review feedback with clarifications Co-authored-by: wham <448809+wham@users.noreply.github.com> --- main.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.md b/main.md index 50a97d1..85970f9 100644 --- a/main.md +++ b/main.md @@ -1201,7 +1201,7 @@ Where `` is a comma-separated list of invalid fields, and `180 days): 0.7 + - SQL: `CASE WHEN julianday('now') - julianday(created_at) < 30 THEN 1.0 WHEN julianday('now') - julianday(created_at) < 180 THEN 0.85 ELSE 0.7 END` #### table:schema_version From 17dc25d71425f504334ea9dfa1d7b0e4846f1ef7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 23:38:35 +0000 Subject: [PATCH 4/4] Implement search ranking improvements in main.go Co-authored-by: wham <448809+wham@users.noreply.github.com> --- main.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 32033ff..0f155e8 100644 --- a/main.go +++ b/main.go @@ -3556,13 +3556,18 @@ func (se *SearchEngine) searchAllTables(tokens []string, limit int) ([]SearchRes slog.Debug("Built FTS query", "fts_query", ftsQuery) // Use pure FTS5 search with bm25() column weights for title prioritization - // bm25(search, 1.0, 3.0, 1.0, 1.0, 1.0, 1.0) weights: type, title(3x), body, url, repository, author - // Multiply by boost to prioritize user's authored content (2x boost) + // bm25(search, 1.0, 5.0, 1.0, 1.0, 1.0, 1.0) weights: type, title(5x), body, url, repository, author + // Multiply by boost for user's contributed repos (2x), state_boost for open items (1.5x), + // and recency_boost based on created_at age (<30d: 1.0, 30-180d: 0.85, >180d: 0.7) query := ` SELECT type, title, body, url, repository, author, created_at, state FROM search WHERE search MATCH ? - ORDER BY (bm25(search, 1.0, 3.0, 1.0, 1.0, 1.0, 1.0) * boost) + ORDER BY (bm25(search, 1.0, 5.0, 1.0, 1.0, 1.0, 1.0) * boost * + CASE WHEN state = 'open' THEN 1.5 ELSE 1.0 END * + CASE WHEN julianday('now') - julianday(created_at) < 30 THEN 1.0 + WHEN julianday('now') - julianday(created_at) < 180 THEN 0.85 + ELSE 0.7 END) LIMIT ?` slog.Debug("Executing FTS query", "sql", query, "search_table", "search", "fts_query", ftsQuery, "limit", limit)