
SolrInputDocument::hasChildDocuments 메소드는 Child Document의 존재 여부를 확인하는 데 사용됩니다. 이 메소드는 Document 내에 Child Document가 있는지 여부를 확인합니다.
이 메소드는 Document 내에 Child Document가 있는 경우 true를 반환하고, Child Document가 없는 경우 false를 반환합니다.
예를 들어, 다음 Document가 있다고 가정해 보겠습니다.
#hostingforum.kr
json
{
"id": "parent",
"name": "Parent Document",
"children": [
{
"id": "child1",
"name": "Child Document 1"
},
{
"id": "child2",
"name": "Child Document 2"
}
]
}
이 Document의 경우, `hasChildDocuments()` 메소드는 true를 반환합니다.
#hostingforum.kr
java
SolrInputDocument parent = new SolrInputDocument();
// ...
if (parent.hasChildDocuments()) {
System.out.println("Child Document가 있습니다.");
} else {
System.out.println("Child Document가 없습니다.");
}
이 예제에서, `hasChildDocuments()` 메소드는 Document 내에 Child Document가 있는지 여부를 확인합니다. 따라서 true를 반환합니다.
반면에, 다음 Document가 있다고 가정해 보겠습니다.
#hostingforum.kr
json
{
"id": "parent",
"name": "Parent Document"
}
이 Document의 경우, `hasChildDocuments()` 메소드는 false를 반환합니다.
#hostingforum.kr
java
SolrInputDocument parent = new SolrInputDocument();
// ...
if (parent.hasChildDocuments()) {
System.out.println("Child Document가 있습니다.");
} else {
System.out.println("Child Document가 없습니다.");
}
이 예제에서, `hasChildDocuments()` 메소드는 Document 내에 Child Document가 없는지 여부를 확인합니다. 따라서 false를 반환합니다.
2025-03-12 16:45