org.apache.solr.search

## Class Grouping.CommandField

- java.lang.Object
- - org.apache.solr.search.Grouping.Command<BytesRef>
  - - org.apache.solr.search.Grouping.CommandField

- Enclosing class:
    Grouping

      public class Grouping.CommandField
      extends Grouping.Command<BytesRef>

  A group command for grouping on a field.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `String` | `groupBy`

    - ### Fields inherited from class org.apache.solr.search.Grouping.Command

      `docsPerGroup, format, groupOffset, groupSort, key, main, numGroups, offset, totalCount, withinGroupSort`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommandField()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AbstractAllGroupHeadsCollector<?>` | `createAllGroupCollector()` Returns a collector that is able to return the most relevant document of all groups.
    `protected Collector` | `createFirstPassCollector()` Returns one or more `Collector` instances that are needed to perform the first pass search.
    `protected Collector` | `createSecondPassCollector()` Returns zero or more `Collector` instances that are needed to perform the second pass search.
    `protected void` | `finish()` Performs any necessary post actions to prepare the response.
    `int` | `getMatches()` Returns the number of matches for this `Command`.
    `protected Integer` | `getNumberOfGroups()` Returns the number of groups found for this `Command`.
    `protected void` | `prepare()` Prepare this `Command` for execution.

    - ### Methods inherited from class org.apache.solr.search.Grouping.Command

      `addDocList, commonResponse, createSimpleResponse, getDocList`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### groupBy

          public String groupBy

  - ### Constructor Detail

    - #### CommandField

          public CommandField()

  - ### Method Detail

    - #### prepare

          protected void prepare()
                          throws IOException

      Prepare this `Command` for execution.
      Specified by:
        `prepare` in class `Grouping.Command<BytesRef>`
      Throws:
        `IOException` - If I/O related errors occur

    - #### createFirstPassCollector

          protected Collector createFirstPassCollector()
                                                throws IOException

      Returns one or more `Collector` instances that are needed to perform the first pass search. If multiple Collectors are returned then these wrapped in a `MultiCollector`.
      Specified by:
        `createFirstPassCollector` in class `Grouping.Command<BytesRef>`
      Returns:
        one or more `Collector` instances that are need to perform the first pass search
      Throws:
        `IOException` - If I/O related errors occur

    - #### createSecondPassCollector

          protected Collector createSecondPassCollector()
                                                 throws IOException

      Returns zero or more `Collector` instances that are needed to perform the second pass search. In the case when no `Collector` instances are created `null` is returned. If multiple Collectors are returned then these wrapped in a `MultiCollector`.
      Overrides:
        `createSecondPassCollector` in class `Grouping.Command<BytesRef>`
      Returns:
        zero or more `Collector` instances that are needed to perform the second pass search
      Throws:
        `IOException` - If I/O related errors occur

    - #### createAllGroupCollector

          public AbstractAllGroupHeadsCollector<?> createAllGroupCollector()
                                                                    throws IOException

      Returns a collector that is able to return the most relevant document of all groups. Returns `null` if the command doesn't support this type of collector.
      Overrides:
        `createAllGroupCollector` in class `Grouping.Command<BytesRef>`
      Returns:
        a collector that is able to return the most relevant document of all groups.
      Throws:
        `IOException` - If I/O related errors occur

    - #### finish

          protected void finish()
                         throws IOException

      Performs any necessary post actions to prepare the response.
      Specified by:
        `finish` in class `Grouping.Command<BytesRef>`
      Throws:
        `IOException` - If I/O related errors occur

    - #### getMatches

          public int getMatches()

      Returns the number of matches for this `Command`.
      Specified by:
        `getMatches` in class `Grouping.Command<BytesRef>`
      Returns:
        the number of matches for this `Command`

    - #### getNumberOfGroups

          protected Integer getNumberOfGroups()

      Returns the number of groups found for this `Command`. If the command doesn't support counting the groups `null` is returned.
      Overrides:
        `getNumberOfGroups` in class `Grouping.Command<BytesRef>`
      Returns:
        the number of groups found for this `Command`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.