Files
basicmachines-co-basic-memory/tests/api/v2
claude[bot] 9de30dd201 perf: batch entity lookup in to_search_results to fix N+1 queries
Replace the per-result `get_entities_by_id` loop in `to_search_results`
with a single batch `find_by_ids` call: collect all unique entity_id,
from_id, and to_id values upfront, fetch them in one query, then use
a lookup dict during result shaping.

This also fixes a pre-existing bug where `from_entity` and `to_entity`
both pointed to `entities[0]` due to unordered IN-query results.
`to_graph_context` (used by recent_activity) already applies this same
pattern; this change makes search hydration consistent.

Closes #710
Related: #707

Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>
2026-04-01 21:59:18 +00:00
..