Open
Conversation
Contributor
Author
|
If a different approach is required or if this approach is inefficient let me know. |
vim345
reviewed
Apr 3, 2026
Contributor
vim345
left a comment
There was a problem hiding this comment.
Overall LGTM. I just had one comment.
Also, AI mentioned the following about missing test coverage:
What's missing:
1. No test for the issue #1 bug path — there's no test that verifies the _nested_child_count doc values accessor is reused across multiple documents in the same segment (i.e. no performance regression test, and the bug wouldn't cause a test failure — just extra allocations).
2. No test for a parent with zero children — the childCount <= 0 early-return path in setDocId is untested.
3. No test for documents without nested fields — i.e. calling _CHILDREN. on a non-parent document in a mixed index.
4. No test for the lastParentDocId caching guard — the early-return if (parentDocId == lastParentDocId) return; is never exercised by a test that calls setDocId twice with the same doc ID.
5. ChildFilterIntegrationTest uses scores to encode results rather than fetching actual field values, which makes assertions somewhat fragile and hard to read — though this is a style concern rather than a correctness gap.
Is it possible to address these as well?
| return; | ||
| } | ||
|
|
||
| LoadedDocValues<?> childCountDocValues = childCountFieldDef.getDocValues(leafContext); |
Contributor
There was a problem hiding this comment.
getDocValues(leafContext) is called on every setDocId invocation rather than once in the constructor (as is done for childFieldDocValues). This allocates a new accessor on every parent document scored. It should be initialized once in the constructor and reused like childFieldDocValues.
Is it possible for you to do some benchmarking to see what the performance looks like with or without the above suggestion?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Ticket
Summary of Changes
_CHILDREN.prefix support in SegmentDocLookup, allowing scoring plugins running on parent documents to access aggregated doc values from their child (nested) documents (e.g., _CHILDREN.appointments.pricereturns all appointment prices across a parent's children)
_nested_child_countas a new meta field on parent documents at index time soChildAggregatedDocValuescan compute the child range without backward scanningTests