Package org.apache.solr.client.solrj.io
Class Tuple
java.lang.Object
org.apache.solr.client.solrj.io.Tuple
- All Implemented Interfaces:
Cloneable,org.apache.solr.common.MapSerializable,org.apache.solr.common.MapWriter,org.apache.solr.common.NavigableObject,org.noggit.JSONWriter.Writable
- Direct Known Subclasses:
DbscanEvaluator.ClusterTuple,KmeansEvaluator.ClusterTuple,KnnRegressionEvaluator.KnnRegressionTuple,LoessEvaluator.LoessRegressionTuple,OLSRegressionEvaluator.MultipleRegressionTuple,RegressionEvaluator.RegressionTuple
A simple abstraction of a record containing key/value pairs. Convenience methods are provided for
returning single and multiValue String, Long and Double values. Note that ints and floats are
treated as longs and doubles respectively.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
org.apache.solr.common.MapWriter.EntryWriter -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWhen EOF field is true the Tuple marks the end of the stream.booleanWhen EXCEPTION field is true the Tuple marks an exception in the stream and the corresponding "EXCEPTION" field contains a related message.Fields inherited from interface org.apache.solr.common.MapWriter
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()static TupleEOF()Create a new empty tuple marked as EOF.static TupleCreate a new empty tuple marked as EXCEPTION, and optionally EOF.static TupleCreate a new empty tuple marked as EXCEPTION and optionally EOF.getDoubles(String key) This represents the mapping of external field labels to the tuple's internal field names if they are different from field names.A list of field names to serialize.Return all tuple fields and their values.getStrings(String key) voidThe other tuples fields and fieldLabels will be merged via putAll directly into this Tuple's fields and fieldLabels while other's fieldNames will be added such that duplicates aren't present.voidvoidvoidvoidsetFieldLabels(Map<String, String> fieldLabels) voidsetFieldNames(List<String> fieldNames) voidvoidsetMetrics(Map<String, Map<?, ?>> metrics) voidwriteMap(org.apache.solr.common.MapWriter.EntryWriter ew) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.common.MapWriter
jsonStr, toMap, writeMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Field Details
-
EOF
public boolean EOFWhen EOF field is true the Tuple marks the end of the stream. The EOF Tuple will not contain a record from the stream, but it may contain metrics/aggregates gathered by underlying streams. -
EXCEPTION
public boolean EXCEPTIONWhen EXCEPTION field is true the Tuple marks an exception in the stream and the corresponding "EXCEPTION" field contains a related message.
-
-
Constructor Details
-
Tuple
public Tuple() -
Tuple
-
Tuple
-
Tuple
A copy constructor.- Parameters:
fields- map containing keys and values to be copied to this tuple
-
Tuple
A copy constructor- Parameters:
original- Tuple that will be copied
-
-
Method Details
-
get
-
put
-
putAll
-
remove
-
getString
-
getException
-
getLong
-
getBool
-
getBools
-
getDate
-
getDates
-
getDouble
-
getStrings
-
getLongs
-
getDoubles
-
getFields
Return all tuple fields and their values. -
getFieldLabels
This represents the mapping of external field labels to the tuple's internal field names if they are different from field names.- Returns:
- field labels or null
-
setFieldLabels
-
getFieldNames
A list of field names to serialize. This list (together with the mapping ingetFieldLabels()) determines what tuple values are serialized and their external (serialized) names.- Returns:
- list of external field names or null
-
setFieldNames
-
getMaps
-
setMaps
-
getMetrics
-
setMetrics
-
clone
-
merge
The other tuples fields and fieldLabels will be merged via putAll directly into this Tuple's fields and fieldLabels while other's fieldNames will be added such that duplicates aren't present.- Parameters:
other- Tuple to be merged into this.
-
writeMap
- Specified by:
writeMapin interfaceorg.apache.solr.common.MapWriter- Throws:
IOException
-
EOF
Create a new empty tuple marked as EOF. -
EXCEPTION
Create a new empty tuple marked as EXCEPTION, and optionally EOF.- Parameters:
msg- exception messageisEOF- if true the tuple will be marked as EOF
-
EXCEPTION
Create a new empty tuple marked as EXCEPTION and optionally EOF.- Parameters:
t- exception - full stack trace will be used as an exception messageisEOF- if true the tuple will be marked as EOF
-