Package org.apache.lucene.document

## Class KnnVectorField

- java.lang.Object
- - org.apache.lucene.document.Field
  - - org.apache.lucene.document.KnnFloatVectorField
    - - org.apache.lucene.document.KnnVectorField

- All Implemented Interfaces:
    `IndexableField`

      @Deprecated
      public class KnnVectorField
      extends KnnFloatVectorField

  Deprecated.
  use `KnnFloatVectorField` instead
  A field that contains a single floating-point numeric vector (or none) for each document. Vectors are dense - that is, every dimension of a vector contains an explicit value, stored packed into an array (of type float[]) whose length is the vector dimension. Values can be retrieved using `FloatVectorValues`, which is a forward-only docID-based iterator and also offers random-access by dense ordinal (not docId). `VectorSimilarityFunction` may be used to compare vectors at query time (for example as part of result ranking). A KnnVectorField may be associated with a search similarity function defining the metric used for nearest-neighbor search among vectors of that field.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.document.Field

      `Field.Store`

  - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.document.Field

      `fieldsData, name, tokenStream, type`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `KnnVectorField​(String name, float[] vector)` | Deprecated. Creates a numeric vector field with the default EUCLIDEAN_HNSW (L2) similarity.
    `KnnVectorField​(String name, float[] vector, FieldType fieldType)` | Deprecated. Creates a numeric vector field.
    `KnnVectorField​(String name, float[] vector, VectorSimilarityFunction similarityFunction)` | Deprecated. Creates a numeric vector field.

  - ### Method Summary

    - ### Methods inherited from class org.apache.lucene.document.KnnFloatVectorField

      `createFieldType, newVectorQuery, setVectorValue, vectorValue`

    - ### Methods inherited from class org.apache.lucene.document.Field

      `binaryValue, fieldType, getCharSequenceValue, invertableType, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, storedValue, stringValue, tokenStream, tokenStreamValue, toString`

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

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

- - ### Constructor Detail

    - #### KnnVectorField

          public KnnVectorField​(String name,
                                float[] vector,
                                VectorSimilarityFunction similarityFunction)

      Deprecated.
      Creates a numeric vector field. Fields are single-valued: each document has either one value or no value. Vectors of a single field share the same dimension and similarity function. Note that some vector similarities (like `VectorSimilarityFunction.DOT_PRODUCT`) require values to be unit-length, which can be enforced using `VectorUtil.l2normalize(float[])`.
      Parameters:
        `name` - field name
        `vector` - value
        `similarityFunction` - a function defining vector proximity.
      Throws:
        `IllegalArgumentException` - if any parameter is null, or the vector is empty or has dimension > 1024.

    - #### KnnVectorField

          public KnnVectorField​(String name,
                                float[] vector)

      Deprecated.
      Creates a numeric vector field with the default EUCLIDEAN_HNSW (L2) similarity. Fields are single-valued: each document has either one value or no value. Vectors of a single field share the same dimension and similarity function.
      Parameters:
        `name` - field name
        `vector` - value
      Throws:
        `IllegalArgumentException` - if any parameter is null, or the vector is empty or has dimension > 1024.

    - #### KnnVectorField

          public KnnVectorField​(String name,
                                float[] vector,
                                FieldType fieldType)

      Deprecated.
      Creates a numeric vector field. Fields are single-valued: each document has either one value or no value. Vectors of a single field share the same dimension and similarity function.
      Parameters:
        `name` - field name
        `vector` - value
        `fieldType` - field type
      Throws:
        `IllegalArgumentException` - if any parameter is null, or the vector is empty or has dimension > 1024.