org.apache.lucene.search

## Class MultiCollector

- java.lang.Object
- - org.apache.lucene.search.MultiCollector

- All Implemented Interfaces:
    Collector

      public class MultiCollector
      extends Object
      implements Collector

  A `Collector` which allows running a search with several `Collector`s. It offers a static `wrap(org.apache.lucene.search.Collector...)` method which accepts a list of collectors and wraps them with `MultiCollector`, while filtering out the `null` null ones.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `LeafCollector` | `getLeafCollector(LeafReaderContext context)` Create a new `collector` to collect the given context.
    `ScoreMode` | `scoreMode()` Indicates what features are required from the scorer.
    `static Collector` | `wrap(Collector... collectors)` See `wrap(Iterable)`.
    `static Collector` | `wrap(Iterable<? extends Collector> collectors)` Wraps a list of `Collector`s with a `MultiCollector`.

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

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

- - ### Method Detail

    - #### wrap

          public static Collector wrap(Collector... collectors)

      See `wrap(Iterable)`.

    - #### wrap

          public static Collector wrap(Iterable<? extends Collector> collectors)

      Wraps a list of `Collector`s with a `MultiCollector`. This method works as follows:
      - Filters out the `null` collectors, so they are not used during search time.
      - If the input contains 1 real collector (i.e. non-`null` ), it is returned.
      - Otherwise the method returns a `MultiCollector` which wraps the non-`null` ones.
      Throws:
        `IllegalArgumentException` - if either 0 collectors were input, or all collectors are `null`.

    - #### scoreMode

          public ScoreMode scoreMode()

      Description copied from interface: `Collector`
      Indicates what features are required from the scorer.
      Specified by:
        `scoreMode` in interface `Collector`

    - #### getLeafCollector

          public LeafCollector getLeafCollector(LeafReaderContext context)
                                         throws IOException

      Description copied from interface: `Collector`
      Create a new `collector` to collect the given context.
      Specified by:
        `getLeafCollector` in interface `Collector`
      Parameters:
        `context` - next atomic reader context
      Throws:
        `IOException`

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