
SolrInputDocument::getChildDocumentsCount 메소드는 SolrInputDocument 객체의 자식 문서 개수를 반환하는 메소드입니다.
이 메소드는 SolrInputDocument 객체가 여러 자식 문서를 가지고 있을 때 사용됩니다. 예를 들어, 다음과 같은 SolrInputDocument 객체가 있다고 가정해 보겠습니다.
#hostingforum.kr
php
$solrDoc = new SolrInputDocument();
$solrDoc->addChildDocument($doc1);
$solrDoc->addChildDocument($doc2);
$solrDoc->addChildDocument($doc3);
이 경우, getChildDocumentsCount 메소드를 사용하여 자식 문서의 개수를 확인할 수 있습니다.
#hostingforum.kr
php
$count = $solrDoc->getChildDocumentsCount();
echo $count; // 출력: 3
이렇게 getChildDocumentsCount 메소드를 사용하여 자식 문서의 개수를 확인할 수 있습니다.
만약 자식 문서가 없을 때 getChildDocumentsCount 메소드를 사용하면, 0을 반환합니다.
#hostingforum.kr
php
$solrDoc = new SolrInputDocument();
$count = $solrDoc->getChildDocumentsCount();
echo $count; // 출력: 0
또한, getChildDocumentsCount 메소드는 SolrInputDocument 객체가 null일 때는 NullPointerException을 발생시킵니다.
#hostingforum.kr
php
$solrDoc = null;
$count = $solrDoc->getChildDocumentsCount();
// NullPointerException 발생
2025-05-02 22:46