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
public class Tuple extends Object implements Cloneable, org.apache.solr.common.MapWriter
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tupleclone()static TupleEOF()Create a new empty tuple marked as EOF.static TupleEXCEPTION(String msg, boolean isEOF)Create a new empty tuple marked as EXCEPTION, and optionally EOF.static TupleEXCEPTION(Throwable t, boolean isEOF)Create a new empty tuple marked as EXCEPTION and optionally EOF.Objectget(String key)BooleangetBool(String key)List<Boolean>getBools(String key)DategetDate(String key)List<Date>getDates(String key)DoublegetDouble(String key)List<Double>getDoubles(String key)StringgetException()Map<String,String>getFieldLabels()This represents the mapping of external field labels to the tuple's internal field names if they are different from field names.List<String>getFieldNames()A list of field names to serialize.Map<String,Object>getFields()Return all tuple fields and their values.LonggetLong(String key)List<Long>getLongs(String key)List<Map<?,?>>getMaps(String key)Map<String,Map<?,?>>getMetrics()StringgetString(String key)List<String>getStrings(String key)voidmerge(Tuple other)The other tuples fields and fieldLabels will be putAll'd directly to this's fields and fieldLabels while other's fieldNames will be added such that duplicates aren't present.voidput(String key, Object value)voidputAll(Map<String,?> fields)voidremove(String key)voidsetFieldLabels(Map<String,String> fieldLabels)voidsetFieldNames(List<String> fieldNames)voidsetMaps(String key, List<Map<?,?>> maps)voidsetMetrics(Map<String,Map<?,?>> metrics)voidwriteMap(org.apache.solr.common.MapWriter.EntryWriter ew)
-
-
-
Field Detail
-
EOF
public boolean EOF
When 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 EXCEPTION
When EXCEPTION field is true the Tuple marks an exception in the stream and the corresponding "EXCEPTION" field contains a related message.
-
-
Method Detail
-
remove
public void remove(String key)
-
getException
public String getException()
-
getFieldLabels
public Map<String,String> 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
-
getFieldNames
public List<String> 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
-
merge
public void merge(Tuple other)
The other tuples fields and fieldLabels will be putAll'd directly to this'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
public void writeMap(org.apache.solr.common.MapWriter.EntryWriter ew) throws IOException- Specified by:
writeMapin interfaceorg.apache.solr.common.MapWriter- Throws:
IOException
-
EOF
public static Tuple EOF()
Create a new empty tuple marked as EOF.
-
EXCEPTION
public static Tuple EXCEPTION(String msg, boolean isEOF)
Create a new empty tuple marked as EXCEPTION, and optionally EOF.- Parameters:
msg- exception messageisEOF- if true the tuple will be marked as EOF
-
-