Skip to content

Fix kbsearch ranking, --root filter, and daemon start - #5

Merged
eSlider merged 1 commit into
mainfrom
fix/kbsearch-ranking-daemon
Aug 13, 2026
Merged

Fix kbsearch ranking, --root filter, and daemon start#5
eSlider merged 1 commit into
mainfrom
fix/kbsearch-ranking-daemon

Conversation

@eSlider

@eSlider eSlider commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • FTS used ORDER BY score (worst BM25 first). Statement is now ORDER BY score DESC, next to vector ORDER BY distance.
  • --root/--repo ran after -n, so facts below the cut vanished. Filter first, then limit.
  • ensureDaemon() existed and was never called; CLI now starts it (Setsid + Release). KBSEARCH_NO_DAEMON=1 keeps the in-process fallback.
  • SET STREAM_SANDBOX ran on a nil connection. Open first, close on error paths, reject quotes in the value.
  • Ranking + flag parsing live in bin/kbsearch/rank (no cgo). CI runs go test ./rank there so these regressions can go red without ladybug.
  • --hop is an error (not swallowed into the query). File/FROM_FILE edges are still missing; hop itself is not in this PR.

Does not take evidence nodes or DROP INDEX from #2 — those would regress b73b4d4.

Test plan

  • go test ./rank -count=1 in bin/kbsearch
  • bin/kb/search "hybrid search" --root facts -n 5 on a local brain with ladybug
  • second search in the same terminal uses the daemon (no full model reload)
  • bin/kb/search "q" --hop 1 exits 2 and does not search for "q 1"

Go search took worst BM25 hits (ORDER BY score), cut to -n before --root,
and never called ensureDaemon. Ranking and flag parsing move to a cgo-free
package so CI can fail those regressions without ladybug. --hop errors
instead of being swallowed into the query.
@cursor

cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@eSlider
eSlider merged commit 669e184 into main Aug 13, 2026
2 checks passed
@eSlider
eSlider deleted the fix/kbsearch-ranking-daemon branch August 13, 2026 11:19
eSlider added a commit that referenced this pull request Aug 13, 2026
#5)

Go search took worst BM25 hits (ORDER BY score), cut to -n before --root,
and never called ensureDaemon. Ranking and flag parsing move to a cgo-free
package so CI can fail those regressions without ladybug. --hop errors
instead of being swallowed into the query.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant