Package com.yahoo.searchlib.aggregation
Class HitsAggregationResult
- java.lang.Object
-
- com.yahoo.vespa.objects.Selectable
-
- com.yahoo.vespa.objects.Identifiable
-
- com.yahoo.searchlib.expression.ExpressionNode
-
- com.yahoo.searchlib.aggregation.AggregationResult
-
- com.yahoo.searchlib.aggregation.HitsAggregationResult
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class HitsAggregationResult extends AggregationResult
This is an aggregated result holding the top n hits for a single group.- Author:
- havardpe, baldersheim, Simon Thoresen Hult
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
classId
-
Constructor Summary
Constructors Constructor Description HitsAggregationResult()
Constructs an empty result node.HitsAggregationResult(int maxHits)
Create a hits aggregation result that will collect the given number of hitsHitsAggregationResult(int maxHits, String summaryClass)
Create a hits aggregation result that will collect the given number of hits of the summaryClass asked.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HitsAggregationResult
addHit(Hit h)
Adds a hit to this aggregation resultHitsAggregationResult
clone()
protected boolean
equalsAggregation(AggregationResult obj)
List<Hit>
getHits()
Obtain the hits collected by this aggregation resultint
getMaxHits()
Obtain the maximum number of hits to collect.ResultNode
getRank()
Returns a value that can be used for ranking.String
getSummaryClass()
Obtain the summary class used to collect the hits.int
hashCode()
protected void
onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
protected int
onGetClassId()
protected void
onMerge(AggregationResult result)
Mmust be implemented by subclasses to support merge.protected void
onSerialize(com.yahoo.vespa.objects.Serializer buf)
void
postMerge()
Hook called when all aggregation results have been merged.void
selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation)
HitsAggregationResult
setMaxHits(int maxHits)
Sets the maximum number of hits to collect.HitsAggregationResult
setSummaryClass(String summaryClass)
Sets the summary class of hits to collect.void
visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
-
Methods inherited from class com.yahoo.searchlib.aggregation.AggregationResult
equalsExpression, getExpression, getResult, getTag, merge, onExecute, onPrepare, setExpression, setTag
-
Methods inherited from class com.yahoo.searchlib.expression.ExpressionNode
equals, execute, executeIterative, onArgument, prepare
-
-
-
-
Constructor Detail
-
HitsAggregationResult
public HitsAggregationResult()
Constructs an empty result node.
-
HitsAggregationResult
public HitsAggregationResult(int maxHits)
Create a hits aggregation result that will collect the given number of hits- Parameters:
maxHits
- maximum number of hits to collect
-
HitsAggregationResult
public HitsAggregationResult(int maxHits, String summaryClass)
Create a hits aggregation result that will collect the given number of hits of the summaryClass asked.- Parameters:
maxHits
- maximum number of hits to collectsummaryClass
- SummaryClass to use for hits to collect
-
-
Method Detail
-
getSummaryClass
public String getSummaryClass()
Obtain the summary class used to collect the hits.- Returns:
- The summary class id.
-
getMaxHits
public int getMaxHits()
Obtain the maximum number of hits to collect.- Returns:
- Max number of hits to collect.
-
setSummaryClass
public HitsAggregationResult setSummaryClass(String summaryClass)
Sets the summary class of hits to collect.- Parameters:
summaryClass
- the summary class to collect.- Returns:
- this, to allow chaining.
-
setMaxHits
public HitsAggregationResult setMaxHits(int maxHits)
Sets the maximum number of hits to collect.- Parameters:
maxHits
- the number of hits to collect.- Returns:
- this, to allow chaining.
-
getHits
public List<Hit> getHits()
Obtain the hits collected by this aggregation result- Returns:
- collected hits
-
addHit
public HitsAggregationResult addHit(Hit h)
Adds a hit to this aggregation result- Parameters:
h
- the hit- Returns:
- this object
-
getRank
public ResultNode getRank()
Description copied from class:AggregationResult
Returns a value that can be used for ranking.- Specified by:
getRank
in classAggregationResult
-
onGetClassId
protected int onGetClassId()
- Overrides:
onGetClassId
in classAggregationResult
-
onSerialize
protected void onSerialize(com.yahoo.vespa.objects.Serializer buf)
- Overrides:
onSerialize
in classAggregationResult
-
onDeserialize
protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
- Overrides:
onDeserialize
in classAggregationResult
-
onMerge
protected void onMerge(AggregationResult result)
Description copied from class:AggregationResult
Mmust be implemented by subclasses to support merge. It is called as theAggregationResult.merge(AggregationResult)
method is invoked.- Specified by:
onMerge
in classAggregationResult
- Parameters:
result
- the result to merge with
-
postMerge
public void postMerge()
Description copied from class:AggregationResult
Hook called when all aggregation results have been merged. This method can be overloaded by subclasses that need special behaviour to occur after merge.- Overrides:
postMerge
in classAggregationResult
-
equalsAggregation
protected boolean equalsAggregation(AggregationResult obj)
- Specified by:
equalsAggregation
in classAggregationResult
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.yahoo.vespa.objects.Identifiable
-
clone
public HitsAggregationResult clone()
- Overrides:
clone
in classAggregationResult
-
visitMembers
public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
- Overrides:
visitMembers
in classAggregationResult
-
selectMembers
public void selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation)
- Overrides:
selectMembers
in classcom.yahoo.vespa.objects.Selectable
-
-