Class PipelineDocument
- java.lang.Object
-
- com.lucidworks.apollo.common.pipeline.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 Summary
Fields Modifier and Type Field Description static java.lang.String[]
ALL_RESERVED_PREFIXES
static java.lang.String
F_RAW_CONTENT
static java.lang.String
F_RESERVED_PREFIX
static java.lang.String
F_SEPARATOR
-
Constructor Summary
Constructors Constructor Description PipelineDocument()
PipelineDocument(PipelineDocument other)
PipelineDocument(java.lang.String id)
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PipelineDocument
addCommand(Command c)
PipelineDocument
addCommand(java.lang.String cmd, java.util.Map<java.lang.String,java.lang.String> params)
void
addCommands(java.util.List<Command> commands)
PipelineDocument
addField(PipelineField fld)
PipelineDocument
addField(java.lang.String name, java.lang.Object value)
This will add a field to the document.PipelineDocument
addField(java.lang.String name, java.lang.Object value, java.lang.String... meta)
PipelineDocument
addField(java.lang.String name, java.lang.Object value, java.util.List<Annotation> annotations)
PipelineDocument
addFieldIfDifferent(PipelineField fld)
PipelineDocument
addFieldIfDifferent(java.lang.String name, java.lang.Object value, java.lang.String... meta)
PipelineDocument
addFieldIfDifferent(java.lang.String name, java.lang.Object value, java.util.List<Annotation> annotations)
Aggregatable
addFields(java.lang.String field, java.util.Collection<?> values)
PipelineDocument
addFields(java.util.Collection<PipelineField> fields)
PipelineDocument
addHint(java.lang.String name, java.lang.String tag)
PipelineDocument
addHints(java.lang.String name, java.lang.String... tags)
PipelineDocument
addHints(java.lang.String name, java.util.Collection<java.lang.String> tags)
PipelineDocument
addMetadata(java.lang.String name, java.lang.String value)
Aggregatable
clear()
void
copyField(java.lang.String src, java.lang.String dest)
PipelineDocument
copyOf()
boolean
equals(java.lang.Object o)
java.util.Set<java.lang.String>
getAllFieldNames()
This method returns all field names, including those that are reserved for internal use.java.util.List<Command>
getCommands()
byte[]
getContent()
java.util.Set<java.lang.String>
getFieldNames()
This method returns a subset of field names excluding those that are reserved for internal use.java.util.Map<java.lang.String,java.util.List<PipelineField>>
getFields()
Return all fields as an (unmodifiable) Map.java.util.List<PipelineField>
getFields(java.lang.String name)
java.util.List<java.lang.Object>
getFieldValues(java.lang.String name)
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.PipelineField
getFirstField(java.lang.String name)
java.lang.Object
getFirstFieldValue(java.lang.String name)
java.util.List<PipelineField>
getFlattenedFields()
java.util.Map<java.lang.String,java.util.Set<java.lang.String>>
getHints()
java.util.Set<java.lang.String>
getHints(java.lang.String name)
java.lang.String
getId()
PipelineField
getLastField(java.lang.String name)
java.util.Map<java.lang.String,java.lang.String>
getMetadata()
java.lang.String
getMetadata(java.lang.String name)
java.util.Set<java.lang.String>
getMetadataNames()
java.util.Set<java.lang.String>
getReservedFieldNames()
This method returns a subset of field names that are reserved for internal use, i.e.boolean
hasField(java.lang.String name)
Return true if this document has the given field.int
hashCode()
boolean
hasHint(java.lang.String name, java.lang.String tag)
boolean
hasMetadata(java.lang.String name)
static java.lang.String
metadataKey(java.lang.String type, java.lang.String name, java.lang.String... additionalNames)
Prefix a key with our reserved prefixF_RESERVED_PREFIX
and join remaining parts with underscoresstatic PipelineDocument
newCommit()
static PipelineDocument
newCommit(java.util.Map<java.lang.String,java.lang.String> params)
static PipelineDocument
newDelete(java.lang.String id, boolean commit)
static PipelineDocument
newDelete(java.lang.String id, int commitWithin)
static PipelineDocument
newDeleteById(java.lang.String id, java.util.Map<java.lang.String,java.lang.String> inputParams)
static PipelineDocument
newDeleteByQuery(java.lang.String query, boolean commit)
static PipelineDocument
newDeleteByQuery(java.lang.String query, java.util.Map<java.lang.String,java.lang.String> inputParams)
static PipelineDocument
newDocument()
static PipelineDocument
newDocument(java.lang.String id)
static PipelineDocument
newOptimize(java.util.Map<java.lang.String,java.lang.String> params)
java.util.Set<java.lang.String>
removeAllHints(java.lang.String name)
PipelineDocument
removeCommands()
PipelineDocument
removeFields(java.lang.String name)
Remove all fields from document that match the given field name.boolean
removeHint(java.lang.String name, java.lang.String tag)
boolean
removeHints(java.lang.String name, java.lang.String... tags)
boolean
removeHints(java.lang.String name, java.util.Collection<java.lang.String> tags)
PipelineDocument
removeMetadata(java.lang.String name)
void
renameField(java.lang.String name, java.lang.String newName)
void
setContent(byte[] data)
PipelineDocument
setField(java.lang.String name, java.lang.Object value)
Set the value of the given field to the given value.PipelineDocument
setField(java.lang.String name, java.lang.Object value, java.lang.String... meta)
PipelineDocument
setField(java.lang.String name, java.lang.Object value, java.util.List<Annotation> annotations)
Aggregatable
setFields(java.lang.String field, java.util.Collection<?> values)
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.PipelineDocument
setHints(java.lang.String name, java.lang.String... tags)
PipelineDocument
setHints(java.lang.String name, java.util.Collection<java.lang.String> tags)
PipelineDocument
setId(java.lang.String id)
void
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
PipelineDocument
setUpdateModifier(java.lang.String fieldName, com.lucidworks.apollo.common.pipeline.UpdateModifier updateModifier)
java.lang.String
toString()
-
-
-
Field Detail
-
F_RAW_CONTENT
public static final java.lang.String F_RAW_CONTENT
- See Also:
- Constant Field Values
-
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
-
F_SEPARATOR
public static final java.lang.String F_SEPARATOR
- See Also:
- Constant Field Values
-
-
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)
-
PipelineDocument
public PipelineDocument(PipelineDocument other)
-
-
Method Detail
-
copyOf
public PipelineDocument copyOf()
- Specified by:
copyOf
in interfaceCopyable<PipelineDocument>
-
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)
-
clear
public Aggregatable clear()
- Specified by:
clear
in interfaceAggregatable
-
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.
-
getFieldNames
public java.util.Set<java.lang.String> getFieldNames()
This method returns a subset of field names excluding those that are reserved for internal use. It's equivalent to callinggetFilteredFieldNames(String...)
and passingF_RESERVED_PREFIX
as argument.- Specified by:
getFieldNames
in interfaceAggregatable
-
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 withALL_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 interfaceAggregatable
- Parameters:
name
- field name (key)value
- value to add- Returns:
- a version of this document with the specified field added.
-
addFields
public Aggregatable addFields(java.lang.String field, java.util.Collection<?> values)
- Specified by:
addFields
in interfaceAggregatable
-
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)
-
addField
public PipelineDocument addField(PipelineField fld)
-
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)
-
addFieldIfDifferent
public PipelineDocument addFieldIfDifferent(PipelineField fld)
-
addFields
public PipelineDocument addFields(java.util.Collection<PipelineField> fields)
-
removeFields
public PipelineDocument removeFields(java.lang.String name)
Remove all fields from document that match the given field name.- Specified by:
removeFields
in interfaceAggregatable
- 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 interfaceAggregatable
- Parameters:
name
- field name (key)value
- value to add- Returns:
- a version of this document with the specified field value set.
-
setFields
public Aggregatable setFields(java.lang.String field, java.util.Collection<?> values)
- Specified by:
setFields
in interfaceAggregatable
-
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 interfaceAggregatable
-
getFirstField
public PipelineField getFirstField(java.lang.String name)
-
getFirstFieldValue
public java.lang.Object getFirstFieldValue(java.lang.String name)
- Specified by:
getFirstFieldValue
in interfaceAggregatable
-
getLastField
public PipelineField getLastField(java.lang.String name)
-
getFlattenedFields
public java.util.List<PipelineField> getFlattenedFields()
-
setId
public PipelineDocument setId(java.lang.String id)
-
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)
-
addCommand
public PipelineDocument addCommand(Command c)
-
removeCommands
public PipelineDocument removeCommands()
-
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()
-
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()
-
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 prefixF_RESERVED_PREFIX
and join remaining parts with underscores- Parameters:
type
- The "type" of this key, e.g. "parser", "datasource", etcname
- The name of the keyadditionalNames
- Additional names to append to this key- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-