diff --git a/document/document.go b/document/document.go index 53033757b..cb3f53787 100644 --- a/document/document.go +++ b/document/document.go @@ -69,6 +69,12 @@ func (d *Document) Size() int { sizeInBytes += entry.Size() } + for _, entry := range d.NestedDocuments { + if entry != nil { + sizeInBytes += entry.Size() + } + } + return sizeInBytes } @@ -112,6 +118,11 @@ func (d *Document) NumPlainTextBytes() uint64 { } } } + for _, nestedDoc := range d.NestedDocuments { + if nestedDoc != nil { + rv += nestedDoc.NumPlainTextBytes() + } + } return rv }