fix(kbsearch): rank FTS correctly, filter before -n, start the daemon. (#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.
This commit is contained in:
2026-08-13 12:19:26 +01:00
committed by GitHub
co-authored by GitHub
parent ebc3f948c1
commit 669e184cf6
10 changed files with 394 additions and 160 deletions
+8 -10
View File
@@ -1,16 +1,14 @@
// Common types and helpers for kbsearch.
package main
import "os"
import (
"os"
"github.com/eSlider/2dph/bin/kbsearch/rank"
)
func eps() string { return os.Getenv("KBTEST_EPS") }
// Hit is one search result, mirroring the python script's dict shape.
type Hit struct {
ID string `json:"id"`
Text string `json:"text"`
Root string `json:"root"`
Source string `json:"-"` // for repo filtering, not in output
Score float64 `json:"score"`
Snippet string `json:"snippet,omitempty"`
}
// Hit is the search hit type; ranking lives in package rank so CI can test
// it without the native ladybug library.
type Hit = rank.Hit