Skip to content

Fix InvertedIndex.forEach document iteration - #261

Closed
Aschenbath wants to merge 1 commit into
Yomguithereal:masterfrom
Aschenbath:fix/mnemonist-inverted-foreach-20261121
Closed

Aschenbath wants to merge 1 commit into
Yomguithereal:masterfrom
Aschenbath:fix/mnemonist-inverted-foreach-20261121

Conversation

@Aschenbath

Copy link
Copy Markdown

InvertedIndex.forEach() never calls its callback, even when the index contains documents. It reads the documents method as if it were the stored document array; the method's length is zero.

Iterate over items instead. Strengthen the existing test to assert that every document was visited in order, and cover callback arguments, default and explicit scopes, and empty or cleared indexes.

Validation on Node 24: two regression tests fail with the original implementation. The full suite passes after the fix (566 passing, one existing pending), and full ESLint passes without a cache.

Prepared with OpenAI Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants