Skip to content

Keyword search raises ZeroDivisionError when the index is empty #68

Description

@Aburke225

KeywordSearcher.search() crashes with ZeroDivisionError (inside rank-bm25's IDF computation) when index() was called with an empty corpus. Searching an empty index should return an empty result list, not crash.

The covering test is marked @pytest.mark.xfail referencing manifest id H-01 — remove the marker as part of the fix.

Relevant files:

  • rag/retriever/keyword_search.py
  • tests/unit/test_keyword_search.py

Estimated effort: 2–4 hours

Activity

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

    bugSomething isn't workinggood first issueGood for newcomersragRetrieval & generationtier-1Starter difficulty

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions