Skip to content

parsing.lucene: reader.terms("references") could be null - #9729

Merged
ebarboni merged 1 commit into
apache:deliveryfrom
mbien:null-terms
Oct 21, 2026
Merged

ebarboni merged 1 commit into
apache:deliveryfrom
mbien:null-terms

Conversation

@mbien

@mbien mbien commented Oct 18, 2026

Copy link
Copy Markdown
Member

DocumentUtil.createDocument() may be called with an empty references list. In that case no "references" fields would be added to the doc and terms would be null.

fixes #9728

targets delivery

@mbien mbien added this to the NB32 milestone Oct 18, 2026
@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Editor labels Oct 18, 2026
@mbien mbien linked an issue Oct 18, 2026 that may be closed by this pull request

@matthiasblaesing matthiasblaesing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Change looks sane for the concrete problem. I looked through the usages of LeafReaderContext#reader though and while most places are correctly guarded there is a second place that might hit the sane problem:

for(LeafReaderContext lrc: in.leaves()) {
TermsEnum te = lrc.reader().terms(field).iterator();
if (te.seekCeil(startBytesRef) != TermsEnum.SeekStatus.END) {

I think it would bee good to add the guard there too.

'DocumentUtil-createDocument()' may be called with an empty references
list. In that case no "references" fields would be added to the doc
and terms would be null.

also updated in MemoryIndex
@mbien

mbien commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

done. Both index impls have now the null check.

@ebarboni
ebarboni merged commit 47dca23 into apache:delivery Oct 21, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Editor Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE thrown from LuceneIndex::queryTermsImpl

4 participants