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.
10 lines
464 B
Go
10 lines
464 B
Go
package rank
|
|
|
|
// BM25 ranks best-first, so the top hits are the *highest* scores; cosine
|
|
// distance ranks best-first ascending. Both mirror kblib.py.
|
|
const FTSStmt = "CALL QUERY_FTS_INDEX('Leaf', 'id', $q) " +
|
|
"RETURN node.id, node.text, node.root, node.source, score ORDER BY score DESC LIMIT $n"
|
|
|
|
const VecStmt = "CALL QUERY_VECTOR_INDEX('Leaf', 'Leaf_vec', $q, $n) " +
|
|
"RETURN node.id, node.text, node.root, node.source, distance ORDER BY distance LIMIT $n"
|