Interface Document


  • public interface Document
    Fusion document. Document instance is an input of an index pipeline stage. One or more Document instances are emitted by an index pipeline as the result of processing.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  Document.Field<T>
      Representation of single field in document.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addFieldValue​(java.lang.String fieldName, java.lang.Object value)
      Add new value to the list of existing field values.
      java.util.Set<Document.Field<java.lang.Object>> allFields()
      Get all fields document contains, including those that are reserved for internal use.
      void delete()
      Mark document for deletion.
      Document.Field<java.lang.Object> field​(java.lang.String fieldName)
      Get or create document field by name.
      <T> Document.Field<T> field​(java.lang.String fieldName, java.lang.Class<T> fieldClass)
      Get or create document of specific type field by name.
      java.util.Set<Document.Field<java.lang.Object>> fields()
      Get all fields document contains, excluding those that are reserved for internal use
      java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> getFieldsAsMap()
      Get document fields as map.
      java.util.List<java.lang.Object> getFieldValues​(java.lang.String fieldName)
      Get all field values.
      java.lang.String getId()
      Get document unique identifier.
      boolean isDelete()
      Check if document is marked for deletion.
      void setFieldValues​(java.lang.String fieldName, java.util.List<?> values)
      Sets list of values to the field, removing any previously existing values.
    • Method Detail

      • getId

        java.lang.String getId()
        Get document unique identifier.
        Returns:
        Identifier assigned to the document or null if identifier hasn't been assigned yet.
      • getFieldsAsMap

        java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> getFieldsAsMap()
        Get document fields as map.
        Returns:
        Map of fields
      • getFieldValues

        java.util.List<java.lang.Object> getFieldValues​(java.lang.String fieldName)
        Get all field values.
        Parameters:
        fieldName - Name of the field
        Returns:
        List of assigned values
      • setFieldValues

        void setFieldValues​(java.lang.String fieldName,
                            java.util.List<?> values)
        Sets list of values to the field, removing any previously existing values.
        Parameters:
        fieldName - Name of the field
        values - List of values to set
      • addFieldValue

        void addFieldValue​(java.lang.String fieldName,
                           java.lang.Object value)
        Add new value to the list of existing field values.
        Parameters:
        fieldName - Name of the field
        value - Value to add
      • delete

        void delete()
        Mark document for deletion. Calling this method will instruct Fusion to remove current document from index.
      • isDelete

        boolean isDelete()
        Check if document is marked for deletion.
        Returns:
        true if document was marked for deletion by the preceding pipeline stages.
      • field

        Document.Field<java.lang.Object> field​(java.lang.String fieldName)
        Get or create document field by name.
        Parameters:
        fieldName - Name of the field
        Returns:
        Document field
      • field

        <T> Document.Field<T> field​(java.lang.String fieldName,
                                    java.lang.Class<T> fieldClass)
        Get or create document of specific type field by name.
        Type Parameters:
        T - The type of field
        Parameters:
        fieldName - Name of the field
        fieldClass - Type of the field
        Returns:
        Document field
      • fields

        java.util.Set<Document.Field<java.lang.Object>> fields()
        Get all fields document contains, excluding those that are reserved for internal use
        Returns:
        Set of document fields
      • allFields

        java.util.Set<Document.Field<java.lang.Object>> allFields()
        Get all fields document contains, including those that are reserved for internal use.
        Returns:
        Set of document fields