create_from_structure method
Leave feedback
On this page
Creates a document from a structure that is an array of text fields.
def create_from_structure(cls, document_key, modification_date, fields):
...
| Parameter | Type | Description |
|---|---|---|
| document_key | str |
The document key. |
| modification_date | datetime |
The document modification date. |
| fields | list[DocumentField] |
The document fields. |
Returns: Document: The created document.
import datetime
from groupdocs.search.common import Document, DocumentField
from groupdocs.search.options import CommonFieldNames
with open(document_file_path, encoding="utf-8") as f:
text = f.read()
fields = [DocumentField(CommonFieldNames.CONTENT, text)]
document = Document.create_from_structure(
"ExampleDocument",
datetime.datetime.now(),
fields,
)
- class
Document
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.