org.apache.lucene.search.grouping

## Class GroupFacetCollector

- java.lang.Object
- - org.apache.lucene.search.SimpleCollector
  - - org.apache.lucene.search.grouping.GroupFacetCollector

- All Implemented Interfaces:
    Collector, LeafCollector
  Direct Known Subclasses:
    TermGroupFacetCollector

      public abstract class GroupFacetCollector
      extends SimpleCollector

  Base class for computing grouped facets.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GroupFacetCollector.FacetEntry` Represents a facet entry with a value and a count.
    `static class` | `GroupFacetCollector.GroupedFacetResult` The grouped facet result.
    `protected static class` | `GroupFacetCollector.SegmentResult` Contains the local grouped segment counts for a particular segment.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `endFacetOrd`
    `protected String` | `facetField`
    `protected BytesRef` | `facetPrefix`
    `protected String` | `groupField`
    `protected int[]` | `segmentFacetCounts`
    `protected List<GroupFacetCollector.SegmentResult>` | `segmentResults`
    `protected int` | `segmentTotalCount`
    `protected int` | `startFacetOrd`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `GroupFacetCollector(String groupField, String facetField, BytesRef facetPrefix)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract GroupFacetCollector.SegmentResult` | `createSegmentResult()`
    `GroupFacetCollector.GroupedFacetResult` | `mergeSegmentResults(int size, int minCount, boolean orderByCount)` Returns grouped facet results that were computed over zero or more segments.
    `ScoreMode` | `scoreMode()`
    `void` | `setScorer(Scorable scorer)`

    - ### Methods inherited from class org.apache.lucene.search.SimpleCollector

      `collect, doSetNextReader, getLeafCollector`

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

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

- - ### Field Detail

    - #### groupField

          protected final String groupField

    - #### facetField

          protected final String facetField

    - #### facetPrefix

          protected final BytesRef facetPrefix

    - #### segmentResults

          protected final List<GroupFacetCollector.SegmentResult> segmentResults

    - #### segmentFacetCounts

          protected int[] segmentFacetCounts

    - #### segmentTotalCount

          protected int segmentTotalCount

    - #### startFacetOrd

          protected int startFacetOrd

    - #### endFacetOrd

          protected int endFacetOrd

  - ### Constructor Detail

    - #### GroupFacetCollector

          protected GroupFacetCollector(String groupField,
                                        String facetField,
                                        BytesRef facetPrefix)

  - ### Method Detail

    - #### mergeSegmentResults

          public GroupFacetCollector.GroupedFacetResult mergeSegmentResults(int size,
                                                                            int minCount,
                                                                            boolean orderByCount)
                                                                     throws IOException

      Returns grouped facet results that were computed over zero or more segments. Grouped facet counts are merged from zero or more segment results.
      Parameters:
        `size` - The total number of facets to include. This is typically offset + limit
        `minCount` - The minimum count a facet entry should have to be included in the grouped facet result
        `orderByCount` - Whether to sort the facet entries by facet entry count. If `false` then the facets are sorted lexicographically in ascending order.
      Returns:
        grouped facet results
      Throws:
        `IOException` - If I/O related errors occur during merging segment grouped facet counts.

    - #### createSegmentResult

          protected abstract GroupFacetCollector.SegmentResult createSegmentResult()
                                                                            throws IOException

      Throws:
        `IOException`

    - #### setScorer

          public void setScorer(Scorable scorer)
                         throws IOException

      Specified by:
        `setScorer` in interface `LeafCollector`
      Overrides:
        `setScorer` in class `SimpleCollector`
      Throws:
        `IOException`

    - #### scoreMode

          public ScoreMode scoreMode()

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