ContentObject

ContentObject["string"]

gives a content object whose content is string.

ContentObject[File[]]

gives a content object whose content is stored in the specified file.

ContentObject["name1"val1,"name2"val2,]

gives a content object with a sequence of fields with names namei and values vali.

Details

  • Properties of content objects can be obtained using ContentObject[]["property"].
  • Possible properties can include:
  • "CreationDate"creation date for file or content object
    "FileByteCount"size of the content of the object on disk, in bytes
    "FileExtension"the file extension, e.g. ".txt"
    "FileName"original file name, excluding directory
    "FileSize"size as a Quantity object
    "Location"location of the original source as a string
    "ModificationDate"modification date for file or content object
    "Plaintext"content converted to a string
    "ReferenceLocation"cloud-accessible URL to use to reference this content
    "Score"score assigned to the content object in a search
    "Snippet"snippet of the content
    "SnippetSource"cloud-accessible document path for producing snippets
  • Some properties, such as "Snippet", are typically only computed when requested.
  • When a content object is created from a file, the "Plaintext" property will typically be computed by first importing the file.
  • ContentObject[] can be used in the input to CreateSearchIndex.

Examples

Basic Examples  (3)

TextSearch with "ContentObject" as third argument returns a list of content objects:

Get the file name of the first result:

Create an object containing some text:

Get only a snippet of the text:

It is also possible to use the Snippet function:

Get properties of the file:

A ContentObject can contain a string:

ContentObject contains metadata:

"Location" and "FileName" are not available if the document is not saved on disk:

Wolfram Research (2015), ContentObject, Wolfram Language function, https://reference.wolfram.com/language/ref/ContentObject.html.

Text

Wolfram Research (2015), ContentObject, Wolfram Language function, https://reference.wolfram.com/language/ref/ContentObject.html.

BibTeX

@misc{reference.wolfram_2021_contentobject, author="Wolfram Research", title="{ContentObject}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/ContentObject.html}", note=[Accessed: 13-June-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_contentobject, organization={Wolfram Research}, title={ContentObject}, year={2015}, url={https://reference.wolfram.com/language/ref/ContentObject.html}, note=[Accessed: 13-June-2021 ]}

CMS

Wolfram Language. 2015. "ContentObject." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ContentObject.html.

APA

Wolfram Language. (2015). ContentObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ContentObject.html