org.apache.lucene.queries.function

## Class ValueSourceScorer

- java.lang.Object
- - org.apache.lucene.search.Scorer
  - - org.apache.lucene.queries.function.ValueSourceScorer

-     public abstract class ValueSourceScorer
      extends Scorer

  `Scorer` which returns the result of `FunctionValues.floatVal(int)` as the score for a document, and which filters out documents that don't match `matches(int)`. This Scorer has a `TwoPhaseIterator`. This is similar to `FunctionQuery`, but this one has no `Weight` normalization factors/multipliers and that one doesn't filter either.

  Note: If the scores are needed, then the underlying value will probably be fetched/computed twice -- once to filter and next to return the score. If that's non-trivial then consider wrapping it in an implementation that will cache the current value.

  See Also:
    `FunctionQuery`
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.search.Scorer

      `Scorer.ChildScorer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FunctionValues` | `values`

    - ### Fields inherited from class org.apache.lucene.search.Scorer

      `weight`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ValueSourceScorer(LeafReaderContext readerContext, FunctionValues values)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `docID()`
    `DocIdSetIterator` | `iterator()`
    `abstract boolean` | `matches(int doc)` Override to decide if this document matches.
    `float` | `score()`
    `TwoPhaseIterator` | `twoPhaseIterator()`

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

      `getChildren, getWeight`

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

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

- - ### Field Detail

    - #### values

          protected final FunctionValues values

  - ### Constructor Detail

    - #### ValueSourceScorer

          protected ValueSourceScorer(LeafReaderContext readerContext,
                                      FunctionValues values)

  - ### Method Detail

    - #### matches

          public abstract boolean matches(int doc)
                                   throws IOException

      Override to decide if this document matches. It's called by `TwoPhaseIterator.matches()`.
      Throws:
        `IOException`

    - #### iterator

          public DocIdSetIterator iterator()

      Specified by:
        `iterator` in class `Scorer`

    - #### twoPhaseIterator

          public TwoPhaseIterator twoPhaseIterator()

      Overrides:
        `twoPhaseIterator` in class `Scorer`

    - #### docID

          public int docID()

      Specified by:
        `docID` in class `Scorer`

    - #### score

          public float score()
                      throws IOException

      Specified by:
        `score` in class `Scorer`
      Throws:
        `IOException`

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