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 final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty result node.
    Grouping(int id)
    Constructs an instance of this class with given client id.
  • Method Summary

    Modifier and Type
    Method
    Description
    Appends the given grouping level specification to the list of levels.
     
    boolean
     
    boolean
    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 single pass execution of grouping is forced.
    int
    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.
    Returns the root group.
    long
    Returns the number of candidate documents to group.
    int
     
    void
    Merges the content of the given grouping into this.
    boolean
    Returns whether 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.
    setRoot(Group root)
    Sets the root group.
    setTopN(long topN)
    Sets the number of candidate documents to group.
    void
     
    boolean
    Returns whether grouping should be executed in a single pass.
    boolean
    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

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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

      public void merge(Grouping rhs)
      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

      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 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 on setAll(boolean).
    • setAll

      public Grouping setAll(boolean all)
      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

      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).
    • 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 on setLastLevel(int).
    • setLastLevel

      public Grouping setLastLevel(int level)
      Sets the last level to do grouping work. Executing a level will instantiate the Group 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.
    • 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 - if level argument is null
    • getRoot

      public Group getRoot()
      Returns the root group.
    • 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 - if root argument is null
    • getForceSinglePass

      public boolean getForceSinglePass()
      Returns whether single pass execution of 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 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:
      onGetClassId in class com.yahoo.vespa.objects.Identifiable
    • onSerialize

      protected void onSerialize(com.yahoo.vespa.objects.Serializer buf)
      Overrides:
      onSerialize in class com.yahoo.vespa.objects.Identifiable
    • onDeserialize

      protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
      Overrides:
      onDeserialize in class com.yahoo.vespa.objects.Identifiable
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.yahoo.vespa.objects.Identifiable
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class com.yahoo.vespa.objects.Identifiable
    • clone

      public Grouping clone()
      Overrides:
      clone in class com.yahoo.vespa.objects.Identifiable
    • visitMembers

      public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
      Overrides:
      visitMembers in class com.yahoo.vespa.objects.Identifiable
    • selectMembers

      public void selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation)
      Overrides:
      selectMembers in class com.yahoo.vespa.objects.Selectable
    • unifyNull

      public void unifyNull()