Document

Inheritance: java.lang.Object

public abstract class Document

Represents the base class for documents added to an index from file system, stream, or structure. Contains static methods for creating documents from different types of sources.

Learn more

Methods

Method Description
getDocumentSourceKind() Gets the document source kind.
getDocumentKey() Gets the document key that is used to identify the document within an index.
isLazy() Gets a value indicating whether the document is loaded as needed or not.
getModificationDate() Gets the last modification date of the document.
getExtension() Gets the extension used for this document type.
getAdditionalFields() Gets the additional fields for the document.
setAdditionalFields(DocumentField[] value) Sets the additional fields for the document.
getAttributes() Gets the attributes of the document.
setAttributes(String[] value) Sets the attributes of the document.
createFromFile(String filePath) Creates a document from a file.
createFromStream(String documentKey, Date modificationDate, String extension, InputStream stream) Creates a document from a stream.
createFromStructure(String documentKey, Date modificationDate, DocumentField[] fields) Creates a document from a structure that is an array of text fields.
createLazy(DocumentSourceKind documentSourceKind, String documentKey, IDocumentLoader documentLoader) Creates a lazy-loaded document.
toString() Returns a java.lang.String that represents the current Document .

getDocumentSourceKind()

public abstract DocumentSourceKind getDocumentSourceKind()

Gets the document source kind.

Returns: DocumentSourceKind - The document source kind.

getDocumentKey()

public abstract String getDocumentKey()

Gets the document key that is used to identify the document within an index.

Returns: java.lang.String - The document key that is used to identify the document within an index.

isLazy()

public abstract boolean isLazy()

Gets a value indicating whether the document is loaded as needed or not.

Returns: boolean - A value indicating whether the document is loaded as needed or not.

getModificationDate()

public abstract Date getModificationDate()

Gets the last modification date of the document.

Returns: java.util.Date - The last modification date of the document.

getExtension()

public abstract String getExtension()

Gets the extension used for this document type.

Returns: java.lang.String - The extension used for this document type.

getAdditionalFields()

public DocumentField[] getAdditionalFields()

Gets the additional fields for the document.

Returns: com.groupdocs.search.common.DocumentField[] - The additional fields for the document.

setAdditionalFields(DocumentField[] value)

public void setAdditionalFields(DocumentField[] value)

Sets the additional fields for the document.

Parameters:

Parameter Type Description
value DocumentField[] The additional fields for the document.

getAttributes()

public String[] getAttributes()

Gets the attributes of the document.

Returns: java.lang.String[] - The attributes of the document.

setAttributes(String[] value)

public void setAttributes(String[] value)

Sets the attributes of the document.

Parameters:

Parameter Type Description
value java.lang.String[] The attributes of the document.

createFromFile(String filePath)

public static Document createFromFile(String filePath)

Creates a document from a file.

Parameters:

Parameter Type Description
filePath java.lang.String The document file path.

Returns: Document - The created document.

createFromStream(String documentKey, Date modificationDate, String extension, InputStream stream)

public static Document createFromStream(String documentKey, Date modificationDate, String extension, InputStream stream)

Creates a document from a stream.

Parameters:

Parameter Type Description
documentKey java.lang.String The document key.
modificationDate java.util.Date The document modification date.
extension java.lang.String The document extension.
stream java.io.InputStream The document stream.

Returns: Document - The created document.

createFromStructure(String documentKey, Date modificationDate, DocumentField[] fields)

public static Document createFromStructure(String documentKey, Date modificationDate, DocumentField[] fields)

Creates a document from a structure that is an array of text fields.

Parameters:

Parameter Type Description
documentKey java.lang.String The document key.
modificationDate java.util.Date The document modification date.
fields DocumentField[] The document fields.

Returns: Document - The created document.

createLazy(DocumentSourceKind documentSourceKind, String documentKey, IDocumentLoader documentLoader)

public static Document createLazy(DocumentSourceKind documentSourceKind, String documentKey, IDocumentLoader documentLoader)

Creates a lazy-loaded document.

Parameters:

Parameter Type Description
documentSourceKind DocumentSourceKind The document source kind. This value must match the kind of the loaded document.
documentKey java.lang.String The document key. This value must match the key of the loaded document.
documentLoader IDocumentLoader The document loader.

Returns: Document - The created document.

toString()

public String toString()

Returns a java.lang.String that represents the current Document .

Returns: java.lang.String - A java.lang.String that represents the current Document .