Class PipelineDocument

  • All Implemented Interfaces:
    Aggregatable, Copyable<PipelineDocument>, java.io.Serializable

    public class PipelineDocument
    extends java.lang.Object
    implements Aggregatable, java.io.Serializable, Copyable<PipelineDocument>
    Fusion internal representation of a "SolrDocument". Please note that if you change this class in ways that affect the serialized form (adding fields, for example) you need to change the deserialization code in GenericJSONDocumentMessageReader.
    See Also:
    Serialized Form
    • Field Detail

      • F_RESERVED_PREFIX

        public static final java.lang.String F_RESERVED_PREFIX
        See Also:
        Constant Field Values
      • ALL_RESERVED_PREFIXES

        public static final java.lang.String[] ALL_RESERVED_PREFIXES
    • Constructor Detail

      • PipelineDocument

        public PipelineDocument()
      • PipelineDocument

        public PipelineDocument​(java.lang.String id)
      • PipelineDocument

        public PipelineDocument​(java.lang.String id,
                                java.util.List<PipelineField> fields,
                                java.util.Map<java.lang.String,​java.lang.String> metadata,
                                java.util.List<Command> commands,
                                java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> hints)
    • Method Detail

      • getId

        public java.lang.String getId()
      • getMetadata

        public java.util.Map<java.lang.String,​java.lang.String> getMetadata()
      • getMetadata

        public java.lang.String getMetadata​(java.lang.String name)
      • hasMetadata

        public boolean hasMetadata​(java.lang.String name)
      • getMetadataNames

        public java.util.Set<java.lang.String> getMetadataNames()
      • setMetadata

        public void setMetadata​(java.util.Map<java.lang.String,​java.lang.String> metadata)
      • addMetadata

        public PipelineDocument addMetadata​(java.lang.String name,
                                            java.lang.String value)
      • removeMetadata

        public PipelineDocument removeMetadata​(java.lang.String name)
      • addHint

        public PipelineDocument addHint​(java.lang.String name,
                                        java.lang.String tag)
      • addHints

        public PipelineDocument addHints​(java.lang.String name,
                                         java.util.Collection<java.lang.String> tags)
      • addHints

        public PipelineDocument addHints​(java.lang.String name,
                                         java.lang.String... tags)
      • setHints

        public PipelineDocument setHints​(java.lang.String name,
                                         java.util.Collection<java.lang.String> tags)
      • setHints

        public PipelineDocument setHints​(java.lang.String name,
                                         java.lang.String... tags)
      • getHints

        public java.util.Set<java.lang.String> getHints​(java.lang.String name)
      • hasHint

        public boolean hasHint​(java.lang.String name,
                               java.lang.String tag)
      • getHints

        public java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getHints()
      • removeHint

        public boolean removeHint​(java.lang.String name,
                                  java.lang.String tag)
      • removeHints

        public boolean removeHints​(java.lang.String name,
                                   java.lang.String... tags)
      • removeHints

        public boolean removeHints​(java.lang.String name,
                                   java.util.Collection<java.lang.String> tags)
      • removeAllHints

        public java.util.Set<java.lang.String> removeAllHints​(java.lang.String name)
      • setUpdateModifier

        public PipelineDocument setUpdateModifier​(java.lang.String fieldName,
                                                  com.lucidworks.apollo.common.pipeline.UpdateModifier updateModifier)
      • renameField

        public void renameField​(java.lang.String name,
                                java.lang.String newName)
      • copyField

        public void copyField​(java.lang.String src,
                              java.lang.String dest)
      • getFields

        public java.util.Map<java.lang.String,​java.util.List<PipelineField>> getFields()
        Return all fields as an (unmodifiable) Map.
      • getAllFieldNames

        public java.util.Set<java.lang.String> getAllFieldNames()
        This method returns all field names, including those that are reserved for internal use.
      • getReservedFieldNames

        public java.util.Set<java.lang.String> getReservedFieldNames()
        This method returns a subset of field names that are reserved for internal use, i.e. field name starts with ALL_RESERVED_PREFIXES
      • getFilteredFieldNames

        public java.util.Set<java.lang.String> getFilteredFieldNames​(java.lang.String... excludePrefixes)
        Returns a filtered subset of field names, where names that start with one of excludePrefixes are excluded.
      • hasField

        public boolean hasField​(java.lang.String name)
        Return true if this document has the given field.
        Parameters:
        name - field name to check for
        Returns:
        true if field is present, otherwise false.
      • setFields

        public void setFields​(java.util.Map<java.lang.String,​java.util.List<PipelineField>> fields)
        Set all fields for this document by clearing existing fields and adding all content from the given fields Map.
        Parameters:
        fields - Map of fields to set in this document.
      • addField

        public PipelineDocument addField​(java.lang.String name,
                                         java.lang.Object value)
        This will add a field to the document. If fields already exist with this name it will append the value to the collection.
        Specified by:
        addField in interface Aggregatable
        Parameters:
        name - field name (key)
        value - value to add
        Returns:
        a version of this document with the specified field added.
      • addField

        public PipelineDocument addField​(java.lang.String name,
                                         java.lang.Object value,
                                         java.lang.String... meta)
      • addField

        public PipelineDocument addField​(java.lang.String name,
                                         java.lang.Object value,
                                         java.util.List<Annotation> annotations)
      • addFieldIfDifferent

        public PipelineDocument addFieldIfDifferent​(java.lang.String name,
                                                    java.lang.Object value,
                                                    java.lang.String... meta)
      • addFieldIfDifferent

        public PipelineDocument addFieldIfDifferent​(java.lang.String name,
                                                    java.lang.Object value,
                                                    java.util.List<Annotation> annotations)
      • removeFields

        public PipelineDocument removeFields​(java.lang.String name)
        Remove all fields from document that match the given field name.
        Specified by:
        removeFields in interface Aggregatable
        Parameters:
        name - name of field to remove
        Returns:
        a version of this document with the specified fields removed.
      • setField

        public PipelineDocument setField​(java.lang.String name,
                                         java.lang.Object value)
        Set the value of the given field to the given value.
        Specified by:
        setField in interface Aggregatable
        Parameters:
        name - field name (key)
        value - value to add
        Returns:
        a version of this document with the specified field value set.
      • setField

        public PipelineDocument setField​(java.lang.String name,
                                         java.lang.Object value,
                                         java.lang.String... meta)
      • setField

        public PipelineDocument setField​(java.lang.String name,
                                         java.lang.Object value,
                                         java.util.List<Annotation> annotations)
      • getFields

        public java.util.List<PipelineField> getFields​(java.lang.String name)
      • getFieldValues

        public java.util.List<java.lang.Object> getFieldValues​(java.lang.String name)
        Specified by:
        getFieldValues in interface Aggregatable
      • getFirstField

        public PipelineField getFirstField​(java.lang.String name)
      • getFirstFieldValue

        public java.lang.Object getFirstFieldValue​(java.lang.String name)
        Specified by:
        getFirstFieldValue in interface Aggregatable
      • getLastField

        public PipelineField getLastField​(java.lang.String name)
      • getFlattenedFields

        public java.util.List<PipelineField> getFlattenedFields()
      • getContent

        public byte[] getContent()
      • setContent

        public void setContent​(byte[] data)
      • getCommands

        public java.util.List<Command> getCommands()
      • addCommands

        public void addCommands​(java.util.List<Command> commands)
      • addCommand

        public PipelineDocument addCommand​(java.lang.String cmd,
                                           java.util.Map<java.lang.String,​java.lang.String> params)
      • newDelete

        public static PipelineDocument newDelete​(java.lang.String id,
                                                 boolean commit)
      • newDelete

        public static PipelineDocument newDelete​(java.lang.String id,
                                                 int commitWithin)
      • newDocument

        public static PipelineDocument newDocument​(java.lang.String id)
      • newDeleteByQuery

        public static PipelineDocument newDeleteByQuery​(java.lang.String query,
                                                        java.util.Map<java.lang.String,​java.lang.String> inputParams)
      • newDeleteById

        public static PipelineDocument newDeleteById​(java.lang.String id,
                                                     java.util.Map<java.lang.String,​java.lang.String> inputParams)
      • newDeleteByQuery

        public static PipelineDocument newDeleteByQuery​(java.lang.String query,
                                                        boolean commit)
      • newCommit

        public static PipelineDocument newCommit​(java.util.Map<java.lang.String,​java.lang.String> params)
      • newOptimize

        public static PipelineDocument newOptimize​(java.util.Map<java.lang.String,​java.lang.String> params)
      • metadataKey

        public static java.lang.String metadataKey​(java.lang.String type,
                                                   java.lang.String name,
                                                   java.lang.String... additionalNames)
        Prefix a key with our reserved prefix F_RESERVED_PREFIX and join remaining parts with underscores
        Parameters:
        type - The "type" of this key, e.g. "parser", "datasource", etc
        name - The name of the key
        additionalNames - Additional names to append to this key
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object