Package com.yahoo.searchlib.aggregation
Class Grouping
java.lang.Object
com.yahoo.vespa.objects.Selectable
com.yahoo.vespa.objects.Identifiable
com.yahoo.searchlib.aggregation.Grouping
- All Implemented Interfaces:
Cloneable
public class Grouping
extends com.yahoo.vespa.objects.Identifiable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLevel(GroupingLevel level) Appends the given grouping level specification to the list of levels.clone()booleanbooleangetAll()Returns whether to perform grouping on the entire document corpus instead of only those matching the search criteria.intReturns the first level to start grouping work.booleanReturns whether single pass execution of grouping is forced.intgetId()Returns the client id of this grouping request.intReturns the last level to do grouping work.Returns the list of grouping levels that make up this grouping request.getRoot()Returns the root group.longgetTopN()Returns the number of candidate documents to group.inthashCode()voidMerges the content of the given grouping into this.booleanReturns whether ordering will need results collected in children.protected voidonDeserialize(com.yahoo.vespa.objects.Deserializer buf) protected intprotected voidonSerialize(com.yahoo.vespa.objects.Serializer buf) voidInvoked after merging is done.voidselectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation) setAll(boolean all) Sets whether to perform grouping on the entire document corpus instead of only those matching the search criteria.setFirstLevel(int level) Sets the first level to start grouping work.setForceSinglePass(boolean forceSinglePass) Sets whether or not grouping should be forced to execute in a single pass.setId(int id) Sets the client id for this grouping request.setLastLevel(int level) Sets the last level to do grouping work.Sets the root group.setTopN(long topN) Sets the number of candidate documents to group.voidbooleanReturns whether grouping should be executed in a single pass.booleanvalid()Returns whether this grouping request is valid.voidvisitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) Methods 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
-
Grouping
public Grouping()Constructs an empty result node. NOTE: This instance is broken until non-optional member data is set. -
Grouping
public Grouping(int id) Constructs an instance of this class with given client id.
-
-
Method Details
-
merge
Merges the content of the given grouping into this. -
postMerge
public void postMerge()Invoked after merging is done. It is intended used for resolving any dependencies or derivates that might have changes due to the merge. -
getId
public int getId()Returns the client id of this grouping request. -
setId
Sets the client id for this grouping request.- Parameters:
id- the identifier to set- Returns:
- this, to allow chaining
-
valid
public boolean valid()Returns whether this grouping request is valid. -
getAll
public boolean getAll()Returns whether to perform grouping on the entire document corpus instead of only those matching the search criteria. Please see note onsetAll(boolean). -
setAll
Sets whether to perform grouping on the entire document corpus instead of only those matching the search criteria. NOTE: This is only possible with streaming search.- Parameters:
all- true to group all documents- Returns:
- this, to allow chaining
-
getTopN
public long getTopN()Returns the number of candidate documents to group. -
setTopN
Sets the number of candidate documents to group.- Parameters:
topN- the number to set- Returns:
- this, to allow chaining
-
getFirstLevel
public int getFirstLevel()Returns the first level to start grouping work. See note onsetFirstLevel(int). -
setFirstLevel
Sets the first level to start grouping work. All the necessary work above this group level is expected to be already done.- Parameters:
level- the level to set- Returns:
- this, to allow chaining
-
getLastLevel
public int getLastLevel()Returns the last level to do grouping work. See note onsetLastLevel(int). -
setLastLevel
Sets the last level to do grouping work. Executing a level will instantiate theGroupobjects for the next level, if there is any. This means that grouping work ends at this level, but also instantiates the groups for level (lastLevel + 1).- Parameters:
level- the level to set- Returns:
- this, to allow chaining
-
getLevels
Returns the list of grouping levels that make up this grouping request. -
addLevel
Appends the given grouping level specification to the list of levels.- Parameters:
level- the level to add- Returns:
- this, to allow chaining
- Throws:
NullPointerException- iflevelargument is null
-
getRoot
Returns the root group. -
setRoot
Sets the root group.- Parameters:
root- the group to set as root- Returns:
- this, to allow chaining
- Throws:
NullPointerException- ifrootargument is null
-
getForceSinglePass
public boolean getForceSinglePass()Returns whether single pass execution of grouping is forced. -
setForceSinglePass
Sets whether or not grouping should be forced to execute in a single pass. If false, thisGroupingmight still execute in a single pass due to other constraints.- Parameters:
forceSinglePass- true to force execution in single pass- Returns:
- this, to allow chaining
-
useSinglePass
public boolean useSinglePass()Returns whether grouping should be executed in a single pass. -
needDeepResultCollection
public boolean needDeepResultCollection()Returns whether ordering will need results collected in children. In that case we will probably just do a single pass. -
onGetClassId
protected int onGetClassId()- Overrides:
onGetClassIdin classcom.yahoo.vespa.objects.Identifiable
-
onSerialize
protected void onSerialize(com.yahoo.vespa.objects.Serializer buf) - Overrides:
onSerializein classcom.yahoo.vespa.objects.Identifiable
-
onDeserialize
protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf) - Overrides:
onDeserializein classcom.yahoo.vespa.objects.Identifiable
-
hashCode
public int hashCode()- Overrides:
hashCodein classcom.yahoo.vespa.objects.Identifiable
-
equals
- Overrides:
equalsin classcom.yahoo.vespa.objects.Identifiable
-
clone
- Overrides:
clonein classcom.yahoo.vespa.objects.Identifiable
-
visitMembers
public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) - Overrides:
visitMembersin classcom.yahoo.vespa.objects.Identifiable
-
selectMembers
public void selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation) - Overrides:
selectMembersin classcom.yahoo.vespa.objects.Selectable
-
unifyNull
public void unifyNull()
-