com.groupdocs.search

Class Document



  • public abstract class Document
    extends Object

    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

    • Method Detail

      • getDocumentSourceKind

        public abstract int getDocumentSourceKind()

        Gets the document source kind.

        Returns:
        The document source kind.
      • getDocumentKey

        public abstract String getDocumentKey()

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

        Returns:
        The document key.
      • isLazy

        public abstract boolean isLazy()

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

        Returns:
        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:
        The last modification date of the document.
      • getExtension

        public abstract String getExtension()

        Gets the extension used for this document type.

        Returns:
        The extension used for this document type.
      • getAdditionalFields

        public final DocumentField[] getAdditionalFields()

        Gets the additional fields for the document.

        Returns:
        The additional fields for the document.
      • setAdditionalFields

        public final void setAdditionalFields(DocumentField[] value)

        Sets the additional fields for the document.

        Parameters:
        value - The additional fields for the document.
      • getAttributes

        public final String[] getAttributes()

        Gets the attributes of the document.

        Returns:
        The attributes of the document.
      • setAttributes

        public final void setAttributes(String[] value)

        Sets the attributes of the document.

        Parameters:
        value - The attributes of the document.
      • createFromFile

        public static Document createFromFile(String filePath)

        Creates a document from a file.

        Parameters:
        filePath - The document file path.
        Returns:
        The created document.
      • createFromStream

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

        Creates a document from a stream.

        Parameters:
        documentKey - The document key.
        modificationDate - The document modification date.
        extension - The document extension.
        stream - The document stream.
        Returns:
        The created document.
      • createFromStructure

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

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

        Parameters:
        documentKey - The document key.
        modificationDate - The document modification date.
        fields - The document fields.
        Returns:
        The created document.
      • createLazy

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

        Creates a lazy-loaded document.

        Parameters:
        documentSourceKind - The document source kind. This value must match the kind of the loaded document.
        documentKey - The document key. This value must match the key of the loaded document.
        documentLoader - The document loader.
        Returns:
      • toString

        public String toString()

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

        Overrides:
        toString in class Object
        Returns:
        A java.lang.String that represents the current Document.