Returns: list[DocumentField]: The extracted fields.
Example
fromgroupdocs.search.commonimportDocumentFieldclassLogExtractor:extensions=[".log"]defget_fields(self,source):ifisinstance(source,str):# source is a file pathreturn[DocumentField("FileName",source),DocumentField("Content",open(source,encoding="utf-8-sig").read()),]# source is a streamreturn[DocumentField("Content",source.read().decode("utf-8-sig"))]extractor=LogExtractor()fields=extractor.get_fields("example.log")forfieldinfields:print(f"{field.name}: {field.value}")
get_fields
Extracts all fields from the specified document.
defget_fields(self,stream):...
Parameter
Type
Description
stream
io.RawIOBase
The document stream.
Returns: The extracted fields.
Aliases
These names call get_fields too, limited to the overloads listed.