Skip to content

Hybrid search full-sorts corpus and replaces index on add #786

Closed

Description

@AmitoVrito

Location: src/synapsekit/retrieval/hybrid_search.py:56-57 (and add_documents)

Problem: sorted(enumerate(scores), ...) sorts the whole corpus to take top_k*2 (use heapq.nlargest/np.argpartition for O(n)). Separately, add_documents replaces the index (self._documents = list(texts)), so incremental callers silently drop prior docs.

Fix: partial selection; make add_documents incremental.

Severity: Low (performance + data loss). Found in production-readiness audit.

Activity

  1. added
    bug
    performance
    on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions