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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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 booleangetHits()Obtain the hits collected by this aggregation resultintObtain 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.inthashCode()protected voidonDeserialize(com.yahoo.vespa.objects.Deserializer buf) protected intprotected voidonMerge(AggregationResult result) Mmust be implemented by subclasses to support merge.protected voidonSerialize(com.yahoo.vespa.objects.Serializer buf) voidHook called when all aggregation results have been merged.voidselectMembers(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.voidvisitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) Methods inherited from class com.yahoo.searchlib.aggregation.AggregationResult
equalsExpression, getExpression, getResult, getTag, merge, onExecute, onPrepare, setExpression, setTagMethods inherited from class com.yahoo.searchlib.expression.ExpressionNode
equals, execute, executeIterative, onArgument, prepareMethods inherited from class com.yahoo.vespa.objects.Identifiable
create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, toStringMethods 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:AggregationResultReturns a value that can be used for ranking.- Specified by:
getRankin classAggregationResult
-
onGetClassId
protected int onGetClassId()- Overrides:
onGetClassIdin classAggregationResult
-
onSerialize
protected void onSerialize(com.yahoo.vespa.objects.Serializer buf) - Overrides:
onSerializein classAggregationResult
-
onDeserialize
protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf) - Overrides:
onDeserializein classAggregationResult
-
onMerge
Description copied from class:AggregationResultMmust be implemented by subclasses to support merge. It is called as theAggregationResult.merge(AggregationResult)method is invoked.- Specified by:
onMergein classAggregationResult- Parameters:
result- the result to merge with
-
postMerge
public void postMerge()Description copied from class:AggregationResultHook called when all aggregation results have been merged. This method can be overloaded by subclasses that need special behaviour to occur after merge.- Overrides:
postMergein classAggregationResult
-
equalsAggregation
- Specified by:
equalsAggregationin classAggregationResult
-
hashCode
public int hashCode()- Overrides:
hashCodein classcom.yahoo.vespa.objects.Identifiable
-
clone
- Overrides:
clonein classAggregationResult
-
visitMembers
public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) - Overrides:
visitMembersin classAggregationResult
-
selectMembers
public void selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation) - Overrides:
selectMembersin classcom.yahoo.vespa.objects.Selectable
-