Skip to content

perf(query): semantic search creates new Memgraph connection per call instead of reusing #505

Description

@vitali87

Problem

In codebase_rag/tools/semantic_search.py, the semantic_code_search() function creates a new MemgraphIngestor context manager on every call rather than reusing the existing ingestor connection that the orchestrator already has. This adds unnecessary connection overhead per semantic search invocation.

Additionally, the code calls the private method ingestor._execute_query() directly instead of using the public fetch_all() API, which bypasses the public interface contract.

Expected Behavior

  1. Reuse the existing Memgraph connection/ingestor instance instead of creating a new one per search call
  2. Use the public fetch_all() method instead of the private _execute_query()

Affected Files

  • codebase_rag/tools/semantic_search.py (lines 39-46)

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance improvements

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions