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 and Description
    `ScorerSupplier()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract long` | `cost()` Get an estimate of the `Scorer` that would be returned by `get(boolean)`.
    `abstract Scorer` | `get(boolean randomAccess)` 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(boolean randomAccess)
                              throws IOException

      Get the `Scorer`. This may not return `null` and must be called at most once.
      Parameters:
        `randomAccess` - A hint about the expected usage of the `Scorer`. If `DocIdSetIterator.advance(int)` or `TwoPhaseIterator` will be used to check whether given doc ids match, then pass `true`. Otherwise if the `Scorer` will be mostly used to lead the iteration using `DocIdSetIterator.nextDoc()`, then `false` should be passed. Under doubt, pass `false` which usually has a better worst-case.
      Throws:
        `IOException`

    - #### cost

          public abstract long cost()

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

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