Package org.apache.lucene.search

## Class ScorerSupplier

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

-     public abstract class ScorerSupplier
      extends Object

  A supplier of `Scorer`. This allows to get an estimate of the cost before building the `Scorer`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ScorerSupplier()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract long` | `cost()` | Get an estimate of the `Scorer` that would be returned by `get(long)`.
    `abstract Scorer` | `get​(long leadCost)` | Get the `Scorer`.

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

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

- - ### Constructor Detail

    - #### ScorerSupplier

          public ScorerSupplier()

  - ### Method Detail

    - #### get

          public abstract Scorer get​(long leadCost)
                              throws IOException

      Get the `Scorer`. This may not return `null` and must be called at most once.
      Parameters:
        `leadCost` - Cost of the scorer that will be used in order to lead iteration. This can be interpreted as an upper bound of the number of times that `DocIdSetIterator.nextDoc()`, `DocIdSetIterator.advance(int)` and `TwoPhaseIterator.matches()` will be called. Under doubt, pass `Long.MAX_VALUE`, which will produce a `Scorer` that has good iteration capabilities.
      Throws:
        `IOException`

    - #### cost

          public abstract long cost()

      Get an estimate of the `Scorer` that would be returned by `get(long)`. This may be a costly operation, so it should only be called if necessary.
      See Also:
        `DocIdSetIterator.cost()`