You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(vector_stores/redis): search score hardcoded for cosine, breaks L2 ranking #7249
That mapping is only correct for cosine. create_col(..., distance=...) already accepts a metric and writes it into the RedisVL schema (distance_metric), but search scoring never reads that metric — L2 (and similar unbounded distances) collapse almost every hit with d > 1 to 0.0, breaking ranking and score thresholds.
Also, RedisDB.__init__ / RedisDBConfig have no distance field, so the default index is always created as cosine in DEFAULT_FIELDS, and there is nowhere for operators to declare the metric used for scoring.
Steps to Reproduce
Create a Redis collection with a non-cosine metric:
Traced this on main and could not confirm it as a live bug. RedisDBConfig has no distance field, extra keys are rejected, and RedisDB.init always builds the index with distance_metric cosine in DEFAULT_FIELDS. Memory never calls create_col with a distance argument, so mem0's Redis store is cosine only today: the L2 score collapse you describe can't happen through any setting we expose. create_col(distance=...) is real code but only reachable by calling it directly on the store object, bypassing config entirely. PRs #7251 and #7253 are identical and would add the missing config plus the metric-aware scoring together, that combination is what this actually needs.
Activity
fix(vector_stores/redis): make search score metric-aware
ktz03 commentedon Sep 8, 2026
PR ready for this issue (Redis sibling of #6546/#7229). It will auto-reopen once labeled
accepted.@kartik-mem0 when convenient, could you add
accepted? Preferred sequence: Valkey #7229 → this Redis fix → Weaviate #7250 / Vertex #7232.fix(vector_stores/redis): make search score metric-aware
ktz03 commentedon Sep 8, 2026
PR ready for this issue (Redis sibling of #6546/#7229). It will auto-reopen once labeled
accepted.@kartik-mem0 when convenient, could you add
accepted? Preferred sequence: Valkey #7229 → this Redis fix → Weaviate #7250 / Vertex #7232.blazingretinol commentedon Sep 25, 2026
Traced this on main and could not confirm it as a live bug. RedisDBConfig has no distance field, extra keys are rejected, and RedisDB.init always builds the index with distance_metric cosine in DEFAULT_FIELDS. Memory never calls create_col with a distance argument, so mem0's Redis store is cosine only today: the L2 score collapse you describe can't happen through any setting we expose. create_col(distance=...) is real code but only reachable by calling it directly on the store object, bypassing config entirely. PRs #7251 and #7253 are identical and would add the missing config plus the metric-aware scoring together, that combination is what this actually needs.