serhiy-bzhezytskyy opened a new pull request, #4785:
URL: https://github.com/apache/solr/pull/4785

   https://issues.apache.org/jira/browse/SOLR-18353
   
   Removed `getChildDocumentCount()` from `SolrDocumentBase` and its overrides 
in `SolrDocument`/`SolrInputDocument`, and migrated all callers to 
`getChildDocuments().size()`.
   
   One thing worth flagging: `getChildDocuments()` returns `null` when there 
are no anonymous children, so `getChildDocuments().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 an `if 
(doc.hasChildDocuments())` guard with `childDocs = doc.getChildDocuments()` 
fetched right after -- reordered to fetch `childDocs` first and pass 
`childDocs.size()`, which also removes a redundant second call to 
`getChildDocuments()`.
   - `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`, `SolrExampleStreamingBinaryHttp2Test` all 
green.
   
   AI-assisted (Claude Sonnet 5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to