Class GroupCommand

  • All Implemented Interfaces:
    Serializable

    public class GroupCommand
    extends Object
    implements Serializable
    This class represents the result of a group command. This can be the result of the following parameter:
    • group.field
    • group.func
    • group.query
    An instance of this class contains:
    • The name of this command. This can be the field, function or query grouped by.
    • The total number of documents that have matched.
    • The total number of groups that have matched.
    • The groups to be displayed. Depending on the start and rows parameter.
    In case of group.query only one group is present and ngroups is always null .
    Since:
    solr 3.4
    See Also:
    Serialized Form
    • Constructor Detail

      • GroupCommand

        public GroupCommand​(String name,
                            int matches)
        Creates a GroupCommand instance
        Parameters:
        name - The name of this command
        matches - The total number of documents found for this command
      • GroupCommand

        public GroupCommand​(String name,
                            int matches,
                            int nGroups)
        Creates a GroupCommand instance.
        Parameters:
        name - The name of this command
        matches - The total number of documents found for this command
        nGroups - The total number of groups found for this command.
    • Method Detail

      • getName

        public String getName()
        Returns the name of this command. This can be the field, function or query grouped by.
        Returns:
        the name of this command
      • add

        public void add​(Group group)
        Adds a group to this command.
        Parameters:
        group - A group to be added
      • getValues

        public List<Group> getValues()
        Returns the groups to be displayed. The number of groups returned depend on the start and rows parameters.
        Returns:
        the groups to be displayed.
      • getMatches

        public int getMatches()
        Returns the total number of documents found for this command.
        Returns:
        the total number of documents found for this command.
      • getNGroups

        public Integer getNGroups()
        Returns the total number of groups found for this command. Returns null if the group.ngroups parameter is unset or false or if this is a group command query (parameter = group.query).
        Returns:
        the total number of groups found for this command.