Package org.apache.lucene.queries.function

## Class FunctionValues

- java.lang.Object
- - org.apache.lucene.queries.function.FunctionValues

- Direct Known Subclasses:
    `BoolDocValues`, `DocTermsIndexDocValues`, `DoubleDocValues`, `FloatDocValues`, `IntDocValues`, `LongDocValues`, `MultiFunction.Values`, `StrDocValues`, `VectorFieldFunction`

      public abstract class FunctionValues
      extends Object

  Represents field values as different types. Normally created via a `ValueSource` for a particular field and reader.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `FunctionValues.ValueFiller` | Abstraction of the logic required to fill the value of a specified doc into a reusable `MutableValue`.

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `boolVal​(int doc)` |
    `boolean` | `bytesVal​(int doc, BytesRefBuilder target)` | returns the bytes representation of the string val - TODO: should this return the indexed raw bytes not?
    `byte` | `byteVal​(int doc)` |
    `void` | `byteVal​(int doc, byte[] vals)` |
    `byte[]` | `byteVectorVal​(int doc)` |
    `float` | `cost()` | An estimate of the expected cost to return a value for a document.
    `double` | `doubleVal​(int doc)` |
    `void` | `doubleVal​(int doc, double[] vals)` |
    `boolean` | `exists​(int doc)` | Returns true if there is a value for this document
    `Explanation` | `explain​(int doc)` |
    `float` | `floatVal​(int doc)` |
    `void` | `floatVal​(int doc, float[] vals)` |
    `float[]` | `floatVectorVal​(int doc)` |
    `ValueSourceScorer` | `getRangeScorer​(Weight weight, LeafReaderContext readerContext, String lowerVal, String upperVal, boolean includeLower, boolean includeUpper)` | Yields a `Scorer` that matches documents with values between the specified range, and that which produces scores equal to `floatVal(int)`.
    `ValueSourceScorer` | `getScorer​(Weight weight, LeafReaderContext readerContext)` | Yields a `Scorer` that matches all documents, and that which produces scores equal to `floatVal(int)`.
    `FunctionValues.ValueFiller` | `getValueFiller()` |
    `int` | `intVal​(int doc)` |
    `void` | `intVal​(int doc, int[] vals)` |
    `long` | `longVal​(int doc)` |
    `void` | `longVal​(int doc, long[] vals)` |
    `int` | `numOrd()` |
    `Object` | `objectVal​(int doc)` | Native Java Object representation of the value
    `int` | `ordVal​(int doc)` |
    `short` | `shortVal​(int doc)` |
    `void` | `shortVal​(int doc, short[] vals)` |
    `String` | `strVal​(int doc)` |
    `void` | `strVal​(int doc, String[] vals)` |
    `abstract String` | `toString​(int doc)` |

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

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

- - ### Constructor Detail

    - #### FunctionValues

          public FunctionValues()

  - ### Method Detail

    - #### byteVal

          public byte byteVal​(int doc)
                       throws IOException

      Throws:
        `IOException`

    - #### shortVal

          public short shortVal​(int doc)
                         throws IOException

      Throws:
        `IOException`

    - #### floatVal

          public float floatVal​(int doc)
                         throws IOException

      Throws:
        `IOException`

    - #### intVal

          public int intVal​(int doc)
                     throws IOException

      Throws:
        `IOException`

    - #### longVal

          public long longVal​(int doc)
                       throws IOException

      Throws:
        `IOException`

    - #### doubleVal

          public double doubleVal​(int doc)
                           throws IOException

      Throws:
        `IOException`

    - #### strVal

          public String strVal​(int doc)
                        throws IOException

      Throws:
        `IOException`

    - #### boolVal

          public boolean boolVal​(int doc)
                          throws IOException

      Throws:
        `IOException`

    - #### floatVectorVal

          public float[] floatVectorVal​(int doc)
                                 throws IOException

      Throws:
        `IOException`

    - #### byteVectorVal

          public byte[] byteVectorVal​(int doc)
                               throws IOException

      Throws:
        `IOException`

    - #### bytesVal

          public boolean bytesVal​(int doc,
                                  BytesRefBuilder target)
                           throws IOException

      returns the bytes representation of the string val - TODO: should this return the indexed raw bytes not?
      Throws:
        `IOException`

    - #### objectVal

          public Object objectVal​(int doc)
                           throws IOException

      Native Java Object representation of the value
      Throws:
        `IOException`

    - #### exists

          public boolean exists​(int doc)
                         throws IOException

      Returns true if there is a value for this document
      Throws:
        `IOException`

    - #### ordVal

          public int ordVal​(int doc)
                     throws IOException

      Parameters:
        `doc` - The doc to retrieve to sort ordinal for
      Returns:
        the sort ordinal for the specified doc TODO: Maybe we can just use intVal for this...
      Throws:
        `IOException`

    - #### numOrd

          public int numOrd()

      Returns:
        the number of unique sort ordinals this instance has

    - #### cost

          public float cost()

      An estimate of the expected cost to return a value for a document. It's intended to be used by TwoPhaseIterator.matchCost implementations. Returns an expected cost in number of simple operations like addition, multiplication, comparing two numbers and indexing an array. The returned value must be positive.

    - #### toString

          public abstract String toString​(int doc)
                                   throws IOException

      Throws:
        `IOException`

    - #### getValueFiller

          public FunctionValues.ValueFiller getValueFiller()

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

    - #### byteVal

          public void byteVal​(int doc,
                              byte[] vals)
                       throws IOException

      Throws:
        `IOException`

    - #### shortVal

          public void shortVal​(int doc,
                               short[] vals)
                        throws IOException

      Throws:
        `IOException`

    - #### floatVal

          public void floatVal​(int doc,
                               float[] vals)
                        throws IOException

      Throws:
        `IOException`

    - #### intVal

          public void intVal​(int doc,
                             int[] vals)
                      throws IOException

      Throws:
        `IOException`

    - #### longVal

          public void longVal​(int doc,
                              long[] vals)
                       throws IOException

      Throws:
        `IOException`

    - #### doubleVal

          public void doubleVal​(int doc,
                                double[] vals)
                         throws IOException

      Throws:
        `IOException`

    - #### strVal

          public void strVal​(int doc,
                             String[] vals)
                      throws IOException

      Throws:
        `IOException`

    - #### explain

          public Explanation explain​(int doc)
                              throws IOException

      Throws:
        `IOException`

    - #### getScorer

          public ValueSourceScorer getScorer​(Weight weight,
                                             LeafReaderContext readerContext)

      Yields a `Scorer` that matches all documents, and that which produces scores equal to `floatVal(int)`.

    - #### getRangeScorer

          public ValueSourceScorer getRangeScorer​(Weight weight,
                                                  LeafReaderContext readerContext,
                                                  String lowerVal,
                                                  String upperVal,
                                                  boolean includeLower,
                                                  boolean includeUpper)
                                           throws IOException

      Yields a `Scorer` that matches documents with values between the specified range, and that which produces scores equal to `floatVal(int)`.
      Throws:
        `IOException`