Bug
brain_search returns vec0 chunk results with useless placeholder excerpts like [vec0 chunk] distance=13.3280 instead of actual matched text content. Users get opaque UUIDs and meaningless distance numbers.
Root Cause
src/search/unified.ts — searchVec0() (line ~301-341) queries ONLY the chunks_vec virtual table (chunk_id + distance), then maps a hardcoded placeholder string as the excerpt. It never JOINs the chunks table or does a second-step batch resolution to fetch actual chunks.content.
The fallback path searchChunksFallback (line ~348-424) correctly JOINs chunks + documents and returns real excerpts — but this path is only used when the vec0 extension isn't loaded (production uses vec0).
Fix
After the vec0 KNN query returns chunk_id list, add a batch SELECT id, content, symbol, chunk_type, start_line, end_line FROM chunks WHERE id IN (...) and populate excerpt with actual content (truncated to ~80 chars, matching the fallback path behavior). Also populate title with a meaningful label (symbol or doc:type#index) instead of vec0:<id>.
Expected Behavior
vec0 chunk results should show actual text excerpts, same as fallback path and FTS5 results.
Bug
brain_searchreturns vec0 chunk results with useless placeholder excerpts like[vec0 chunk] distance=13.3280instead of actual matched text content. Users get opaque UUIDs and meaningless distance numbers.Root Cause
src/search/unified.ts—searchVec0()(line ~301-341) queries ONLY thechunks_vecvirtual table (chunk_id + distance), then maps a hardcoded placeholder string as the excerpt. It never JOINs thechunkstable or does a second-step batch resolution to fetch actualchunks.content.The fallback path
searchChunksFallback(line ~348-424) correctly JOINschunks+documentsand returns real excerpts — but this path is only used when the vec0 extension isn't loaded (production uses vec0).Fix
After the vec0 KNN query returns
chunk_idlist, add a batchSELECT id, content, symbol, chunk_type, start_line, end_line FROM chunks WHERE id IN (...)and populateexcerptwith actual content (truncated to ~80 chars, matching the fallback path behavior). Also populatetitlewith a meaningful label (symbol or doc:type#index) instead ofvec0:<id>.Expected Behavior
vec0 chunk results should show actual text excerpts, same as fallback path and FTS5 results.