mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix: use max() instead of min() in LinkResolver search fallback
The search fallback (strategy 5) was using min() to select the best match from FTS results, which selected the WORST match instead of the best. On both SQLite and Postgres backends, higher scores indicate better matches (FTS rank, vector similarity normalized to [0,1], hybrid fusion). Using max() correctly returns the highest-scoring result. Fixes #640 Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com> Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
This commit is contained in:
@@ -302,7 +302,7 @@ class LinkResolver:
|
||||
|
||||
if results:
|
||||
# Look for best match
|
||||
best_match = min(results, key=lambda x: x.score) # pyright: ignore
|
||||
best_match = max(results, key=lambda x: x.score) # pyright: ignore
|
||||
logger.trace(
|
||||
f"Selected best match from {len(results)} results: {best_match.permalink}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user