get_found_document method

get_found_document

Retrieves the found document by its index.

In evaluation mode only the first 10 found documents are accessible. The document_count property reports the total number of matches, but calling get_found_document with an index of 10 or greater raises LicenseRestrictionException with the message “Only first 10 results can be returned”.

def get_found_document(self, index):
    ...
Parameter Type Description
index int The index of a found document.

Returns: GroupDocs.Search.Scaling.Results.FoundDocument: The found document.

Raises Description
LicenseRestrictionException If index is 10 or greater in evaluation mode.

Example

from groupdocs.search import Index

index = Index("./index")
index.add("./documents")

result = index.search("contract")
count = min(result.document_count, 10)  # Only the first 10 found documents are available in the evaluation mode
for i in range(count):
    document = result.get_found_document(i)
    print(document.document_info.file_path)

Aliases

These names call get_found_document too, limited to the overloads listed.

Alias Accepts
get_found_document_int32 get_found_document_int32(index)

See Also