SOLR-18353: Remove deprecated SolrDocumentBase.getChildDocumentCount() - #4785
Open
serhiy-bzhezytskyy wants to merge 1 commit into
Open
Conversation
Removed the method and its SolrDocument/SolrInputDocument overrides. Migrated 6 call sites to getChildDocuments().size(), null-checking where getChildDocuments() isn't already guarded by hasChildDocuments().
epugh
approved these changes
Aug 21, 2026
epugh
left a comment
Contributor
There was a problem hiding this comment.
LGTM, this at least seemed pretty straightforward removal!
Contributor
|
I wonder if getChildDocuments should return an empty list if there are no child docs instead of null? WDYT @dsmiley ? |
dsmiley
reviewed
Aug 21, 2026
dsmiley
left a comment
Contributor
There was a problem hiding this comment.
Thanks!
Please remove the changelog. Too niche/bespoke of a method.
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.
https://issues.apache.org/jira/browse/SOLR-18353
Removed
getChildDocumentCount()fromSolrDocumentBaseand its overrides inSolrDocument/SolrInputDocument, and migrated all callers togetChildDocuments().size().One thing worth flagging:
getChildDocuments()returnsnullwhen there are no anonymous children, sogetChildDocuments().size()isn't a safe drop-in everywhere -- the removed method existed partly to hide that null-check. Handled per call site:JSONWriter/GeoJSONResponseWriter: already inside anif (doc.hasChildDocuments())guard withchildDocs = doc.getChildDocuments()fetched right after -- reordered to fetchchildDocsfirst and passchildDocs.size(), which also removes a redundant second call togetChildDocuments().SolrExampleStreamingBinaryTest/Http2Test(4 sites):assertEquals(1, ...)right after adding exactly one child -- safe as a bare.getChildDocuments().size().TestCloudNestedDocsSort: children are added conditionally in a loop and may never be added -- kept the null-safe ternary (hasChildDocuments() ? getChildDocuments().size() : 0).Changelog added (
type: removed).Tests:
TestChildDocTransformer,TestCloudNestedDocsSort,SolrExampleStreamingBinaryTest,SolrExampleStreamingBinaryHttp2Testall green.AI-assisted (Claude Sonnet 5)