summaryrefslogtreecommitdiff
path: root/rag/storage.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-03-08 16:12:32 +0300
committerGrail Finder <wohilas@gmail.com>2026-03-08 16:12:32 +0300
commita1b5f9cdc59938901123650fc0900067ac3447ca (patch)
tree8a5b06fa85940ecdf9fab065bba4235a358222d6 /rag/storage.go
parente74ff8c03faaf156ad684eda48c8cfa35082ce1a (diff)
Enha: rag tuning and tests
Diffstat (limited to 'rag/storage.go')
-rw-r--r--rag/storage.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/rag/storage.go b/rag/storage.go
index 62477b6..a53f767 100644
--- a/rag/storage.go
+++ b/rag/storage.go
@@ -340,11 +340,9 @@ func (vs *VectorStorage) scanRows(rows *sql.Rows) ([]models.VectorRow, error) {
continue
}
// Convert BM25 score to distance-like metric (lower is better)
- // BM25 is negative, more negative is better. We'll normalize to positive distance.
- distance := float32(-score) // Make positive (since score is negative)
- if distance < 0 {
- distance = 0
- }
+ // BM25 is negative, more negative is better. Keep as negative.
+ distance := float32(score) // Keep negative, more negative is better
+ // No clamping needed; negative distances are fine
results = append(results, models.VectorRow{
Slug: slug,
RawText: rawText,