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
This is an aggregated result holding the top n hits for a single group.
- Author:
- havardpe, baldersheim, Simon Thoresen Hult
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs 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
Modifier and TypeMethodDescriptionAdds a hit to this aggregation resultclone()
protected boolean
getHits()
Obtain the hits collected by this aggregation resultint
Obtain the maximum number of hits to collect.getRank()
Returns a value that can be used for ranking.Obtain the summary class used to collect the hits.int
hashCode()
protected void
onDeserialize
(com.yahoo.vespa.objects.Deserializer buf) protected int
protected void
onMerge
(AggregationResult result) Mmust be implemented by subclasses to support merge.protected void
onSerialize
(com.yahoo.vespa.objects.Serializer buf) void
Hook called when all aggregation results have been merged.void
selectMembers
(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation) setMaxHits
(int maxHits) Sets the maximum number of hits to collect.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
Methods inherited from class com.yahoo.vespa.objects.Identifiable
create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, toString
Methods inherited from class com.yahoo.vespa.objects.Selectable
select, select
-
Field Details
-
classId
public static final int classId
-
-
Constructor Details
-
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
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 Details
-
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
Sets the summary class of hits to collect.- Parameters:
summaryClass
- the summary class to collect.- Returns:
- this, to allow chaining.
-
setMaxHits
Sets the maximum number of hits to collect.- Parameters:
maxHits
- the number of hits to collect.- Returns:
- this, to allow chaining.
-
getHits
Obtain the hits collected by this aggregation result- Returns:
- collected hits
-
addHit
Adds a hit to this aggregation result- Parameters:
h
- the hit- Returns:
- this object
-
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
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
- Specified by:
equalsAggregation
in classAggregationResult
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.yahoo.vespa.objects.Identifiable
-
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
-