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 Modifier and Type Field Description static int
classId
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Grouping
addLevel(GroupingLevel level)
Appends the given grouping level specification to the list of levels.Grouping
clone()
boolean
equals(Object obj)
boolean
getAll()
Returns whether or not to perform grouping on the entire document corpus instead of only those matching the search criteria.int
getFirstLevel()
Returns the first level to start grouping work.boolean
getForceSinglePass()
Returns whether or not single pass execution of grouping is forced.int
getId()
Returns the client id of this grouping request.int
getLastLevel()
Returns the last level to do grouping work.List<GroupingLevel>
getLevels()
Returns the list of grouping levels that make up this grouping request.Group
getRoot()
Returns the root group.long
getTopN()
Returns the number of candidate documents to group.int
hashCode()
void
merge(Grouping rhs)
Merges the content of the given grouping into this.boolean
needDeepResultCollection()
Tell if ordering will need results collected in children.protected void
onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
protected int
onGetClassId()
protected void
onSerialize(com.yahoo.vespa.objects.Serializer buf)
void
postMerge()
This method is invoked after merging is done.void
selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation)
Grouping
setAll(boolean all)
Sets whether or not to perform grouping on the entire document corpus instead of only those matching the search criteria.Grouping
setFirstLevel(int level)
Sets the first level to start grouping work.Grouping
setForceSinglePass(boolean forceSinglePass)
Sets whether or not grouping should be forced to execute in a single pass.Grouping
setId(int id)
Sets the client id for this grouping request.Grouping
setLastLevel(int level)
Sets the last level to do grouping work.Grouping
setRoot(Group root)
Sets the root group.Grouping
setTopN(long topN)
Sets the number of candidate documents to group.void
unifyNull()
boolean
useSinglePass()
Returns whether or not grouping should be executed in a single pass.boolean
valid()
Returns whether or not this grouping request is valid.void
visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
-
-
-
Method Detail
-
merge
public void merge(Grouping rhs)
Merges the content of the given grouping into this.
- Parameters:
rhs
- The grouping to merge with.
-
postMerge
public void postMerge()
This method is 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.
- Returns:
- The identifier.
-
setId
public Grouping setId(int id)
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 or not this grouping request is valid.
- Returns:
- True if valid.
-
getAll
public boolean getAll()
Returns whether or not to perform grouping on the entire document corpus instead of only those matching the search criteria. Please see note on
setAll(boolean)
.- Returns:
- True if grouping all documents.
-
setAll
public Grouping setAll(boolean all)
Sets whether or not 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.
- Returns:
- The number.
-
setTopN
public Grouping setTopN(long topN)
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 on
setFirstLevel(int)
.- Returns:
- The first level.
-
setFirstLevel
public Grouping setFirstLevel(int level)
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
public Grouping setLastLevel(int level)
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
public List<GroupingLevel> getLevels()
Returns the list of grouping levels that make up this grouping request.
- Returns:
- The list.
-
addLevel
public Grouping addLevel(GroupingLevel level)
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
public Group getRoot()
Returns the root group.
- Returns:
- The root.
-
setRoot
public Grouping setRoot(Group root)
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
public Grouping setForceSinglePass(boolean forceSinglePass)
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
public boolean equals(Object obj)
- Overrides:
equals
in classcom.yahoo.vespa.objects.Identifiable
-
clone
public Grouping 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()
-
-