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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddLevel
(GroupingLevel level) Appends the given grouping level specification to the list of levels.clone()
boolean
boolean
getAll()
Returns whether to perform grouping on the entire document corpus instead of only those matching the search criteria.int
Returns the first level to start grouping work.boolean
Returns whether or not single pass execution of grouping is forced.int
getId()
Returns the client id of this grouping request.int
Returns the last level to do grouping work.Returns the list of grouping levels that make up this grouping request.getRoot()
Returns the root group.long
getTopN()
Returns the number of candidate documents to group.int
hashCode()
void
Merges the content of the given grouping into this.boolean
Tell if ordering will need results collected in children.protected void
onDeserialize
(com.yahoo.vespa.objects.Deserializer buf) protected int
protected void
onSerialize
(com.yahoo.vespa.objects.Serializer buf) void
Invoked after merging is done.void
selectMembers
(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.void
boolean
Returns whether or not grouping should be executed in a single pass.boolean
valid()
Returns whether this grouping request is valid.void
visitMembers
(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, toString
Methods 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.- Parameters:
id
- the client id for this grouping request
-
-
Method Details
-
merge
Merges the content of the given grouping into this.- Parameters:
rhs
- the grouping to merge with
-
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 theGroup
objects 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
- Iflevel
argument 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
- Ifroot
argument is null
-
getForceSinglePass
public boolean getForceSinglePass()Returns whether or not single pass execution of grouping is forced.
- Returns:
- True if single pass grouping is forced.
-
setForceSinglePass
Sets whether or not grouping should be forced to execute in a single pass. If false, this
Grouping
might 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 or not grouping should be executed in a single pass.
- Returns:
- True if grouping should be executed in a single pass.
-
needDeepResultCollection
public boolean needDeepResultCollection()Tell if ordering will need results collected in children. in that case we will probably just do a single pass.
- Returns:
- If deeper resultcollection is needed.
-
onGetClassId
protected int onGetClassId()- Overrides:
onGetClassId
in classcom.yahoo.vespa.objects.Identifiable
-
onSerialize
protected void onSerialize(com.yahoo.vespa.objects.Serializer buf) - Overrides:
onSerialize
in classcom.yahoo.vespa.objects.Identifiable
-
onDeserialize
protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf) - Overrides:
onDeserialize
in classcom.yahoo.vespa.objects.Identifiable
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.yahoo.vespa.objects.Identifiable
-
equals
- Overrides:
equals
in classcom.yahoo.vespa.objects.Identifiable
-
clone
- Overrides:
clone
in classcom.yahoo.vespa.objects.Identifiable
-
visitMembers
public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) - Overrides:
visitMembers
in classcom.yahoo.vespa.objects.Identifiable
-
selectMembers
public void selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation) - Overrides:
selectMembers
in classcom.yahoo.vespa.objects.Selectable
-
unifyNull
public void unifyNull()
-