Whatever message this page gives is out now! Go check it out!

lazyLoad

Last update:
May 18, 2026
Returns a lazy iterator (DocumentIterable) for large corpora where loading all documents into memory at once is impractical. Processes and yields documents one at a time.

Syntax

docService.lazyLoad(config)

Parameters

The config argument accepts the same keys as load(). See the load() reference for the full parameter list.

Returns

Returns a DocumentIterable with two methods:
  • hasNext(): Returns true if more documents are available.
  • next(): Returns the next document Struct (with text and metadata).

Example

iter = docService.lazyLoad({ path: "./large-docs/", recursive: true });
while (iter.hasNext()) {
    doc = iter.next();
    writeOutput("Processing: #doc.metadata.source#<br>");
}

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page