apache / apache/lucene

CompressingTermVectors should put checkDoc and checkPosition within assert [LUCENE-6011]

Open
#7,073 0 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Minor module:core/codecs type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

CompressingTermVectorsReader.TVDocsEnum calls checkPosition() and checkDoc() but not from within asserts. And nextPosition() has some leading checks, also not within asserts. I believe these should all be within asserts. This is low-level code that can get called a ton of times, particularly via TokenSources.getTokenStream.

I'd be happy to create a patch there is preliminary agreement.

---
Migrated from [LUCENE-6011](https://issues.apache.org/jira/browse/LUCENE-6011) by David Smiley (@dsmiley)

Contributor guide

Open the contributing guide

Research direction

Start at CompressingTermVectorsReader.TVDocsEnum and inspect checkPosition(), checkDoc(), and nextPosition(), especially their leading checks. Review how TokenSources.getTokenStream reaches this code, then confirm the relevant checks are evaluated only through assertions without changing behavior when assertions are disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.