Skip to content

Commit

Permalink
Remove deprecated float vector classes and methods (#12107)
Browse files Browse the repository at this point in the history
Follow-up of #12105 to remove the deprecated classes for the next major version.

Removes KnnVectorField, KnnVectorQuery, VectorValues and LeafReader#getVectorValues.
  • Loading branch information
javanna authored Jan 24, 2023
1 parent ce8eaf1 commit 95e2cfc
Show file tree
Hide file tree
Showing 22 changed files with 32 additions and 265 deletions.
3 changes: 3 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ API Changes

* GITHUB#11814: Support deletions in IndexRearranger. (Stefan Vodita)

* GITHUB#12107: Remove deprecated KnnVectorField, KnnVectorQuery, VectorValues and
LeafReader#getVectorValues. (Luca Cavanna)

New Features
---------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public final class Lucene90HnswGraphBuilder {
private final RandomAccessVectorValues<float[]> buildVectors;

/**
* Reads all the vectors from a VectorValues, builds a graph connecting them by their dense
* Reads all the vectors from vector values, builds a graph connecting them by their dense
* ordinals, using the given hyperparameter settings, and returns the resulting graph.
*
* @param vectors the vectors whose relations are represented by the graph - must provide a
Expand Down Expand Up @@ -96,8 +96,8 @@ public Lucene90HnswGraphBuilder(
}

/**
* Reads all the vectors from two copies of a random access VectorValues. Providing two copies
* enables efficient retrieval without extra data copying, while avoiding collision of the
* Reads all the vectors from two copies of a {@link RandomAccessVectorValues}. Providing two
* copies enables efficient retrieval without extra data copying, while avoiding collision of the
* returned values.
*
* @param vectors the vectors for which to build a nearest neighbors graph. Must be an independet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public final class Lucene91HnswGraphBuilder {
private RandomAccessVectorValues<float[]> buildVectors;

/**
* Reads all the vectors from a VectorValues, builds a graph connecting them by their dense
* Reads all the vectors from vector values, builds a graph connecting them by their dense
* ordinals, using the given hyperparameter settings, and returns the resulting graph.
*
* @param vectors the vectors whose relations are represented by the graph - must provide a
Expand Down Expand Up @@ -112,8 +112,8 @@ public Lucene91HnswGraphBuilder(
}

/**
* Reads all the vectors from two copies of a random access VectorValues. Providing two copies
* enables efficient retrieval without extra data copying, while avoiding collision of the
* Reads all the vectors from two copies of a {@link RandomAccessVectorValues}. Providing two
* copies enables efficient retrieval without extra data copying, while avoiding collision of the
* returned values.
*
* @param vectors the vectors for which to build a nearest neighbors graph. Must be an independet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public TopDocs search(
}
}

/** Sorting VectorValues that iterate over documents in the order of the provided sortMap */
/** Sorting FloatVectorValues that iterate over documents in the order of the provided sortMap */
private static class SortingVectorValues extends FloatVectorValues {
private final BufferedVectorValues randomAccess;
private final int[] docIdOffsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static KnnVectorsFormat forName(String name) {
new KnnVectorsFormat("EMPTY") {
@Override
public KnnVectorsWriter fieldsWriter(SegmentWriteState state) {
throw new UnsupportedOperationException("Attempt to write EMPTY VectorValues");
throw new UnsupportedOperationException("Attempt to write EMPTY vector values");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public int nextDoc() throws IOException {
}
}

/** View over multiple VectorValues supporting iterator-style access via DocIdMerger. */
/** View over multiple vector values supporting iterator-style access via DocIdMerger. */
protected static final class MergedVectorValues {
private MergedVectorValues() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public void setVectorAttributes(
}
if (numDimensions > FloatVectorValues.MAX_DIMENSIONS) {
throw new IllegalArgumentException(
"vector numDimensions must be <= VectorValues.MAX_DIMENSIONS (="
"vector numDimensions must be <= FloatVectorValues.MAX_DIMENSIONS (="
+ FloatVectorValues.MAX_DIMENSIONS
+ "); got "
+ numDimensions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
* an array (of type float[]) whose length is the vector dimension. Values can be retrieved using
* {@link FloatVectorValues}, which is a forward-only docID-based iterator and also offers
* random-access by dense ordinal (not docId). {@link 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.
* compare vectors at query time (for example as part of result ranking). A {@link
* KnnFloatVectorField} may be associated with a search similarity function defining the metric used
* for nearest-neighbor search among vectors of that field.
*
* @lucene.experimental
*/
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public static final class PointsStatus {
public Throwable error;
}

/** Status from testing VectorValues */
/** Status from testing vector values */
public static final class VectorValuesStatus {

VectorValuesStatus() {}
Expand Down Expand Up @@ -1015,7 +1015,7 @@ private Status.SegmentInfoStatus testSegment(
// Test PointValues
segInfoStat.pointsStatus = testPoints(reader, infoStream, failFast);

// Test VectorValues
// Test FloatVectorValues and ByteVectorValues
segInfoStat.vectorValuesStatus = testVectors(reader, infoStream, failFast);

// Test Index Sort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ private void checkAndThrow() {
throw new ExitingReaderException(
"The request took too long to iterate over vector values. Timeout: "
+ queryTimeout.toString()
+ ", VectorValues="
+ ", FloatVectorValues="
+ in);
} else if (Thread.interrupted()) {
throw new ExitingReaderException(
"Interrupted while iterating over vector values. VectorValues=" + in);
"Interrupted while iterating over vector values. FloatVectorValues=" + in);
}
}
}
Expand Down Expand Up @@ -521,11 +521,11 @@ private void checkAndThrow() {
throw new ExitingReaderException(
"The request took too long to iterate over vector values. Timeout: "
+ queryTimeout.toString()
+ ", VectorValues="
+ ", ByteVectorValues="
+ in);
} else if (Thread.interrupted()) {
throw new ExitingReaderException(
"Interrupted while iterating over vector values. VectorValues=" + in);
"Interrupted while iterating over vector values. ByteVectorValues=" + in);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public boolean hasPointValues() {
return hasPointValues;
}

/** Returns true if any fields have VectorValues */
/** Returns true if any fields have vector values */
public boolean hasVectorValues() {
return hasVectorValues;
}
Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions lucene/core/src/java/org/apache/lucene/index/LeafReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,6 @@ public final PostingsEnum postings(Term term) throws IOException {
*/
public abstract NumericDocValues getNormValues(String field) throws IOException;

/**
* Returns {@link VectorValues} for this field, or null if no {@link VectorValues} were indexed.
* The returned instance should only be used by a single thread.
*
* @deprecated use {@link #getFloatVectorValues(String)} instead
*/
@Deprecated
public VectorValues getVectorValues(String field) throws IOException {
return new FilterVectorValues(getFloatVectorValues(field)) {};
}

/**
* Returns {@link FloatVectorValues} for this field, or null if no {@link FloatVectorValues} were
* indexed. The returned instance should only be used by a single thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public PointValues.Relation compare(byte[] minPackedValue, byte[] maxPackedValue
}
}

/** Sorting VectorValues that iterate over documents in the order of the provided sortMap */
/** Sorting FloatVectorValues that iterate over documents in the order of the provided sortMap */
private static class SortingFloatVectorValues extends FloatVectorValues {
final int size;
final int dimension;
Expand Down
32 changes: 0 additions & 32 deletions lucene/core/src/java/org/apache/lucene/index/VectorValues.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public int hashCode() {
}

/**
* @return the KnnVectorField where the KnnVector search happens.
* @return the knn vector field where the knn vector search happens.
*/
public String getField() {
return field;
Expand Down
Loading

0 comments on commit 95e2cfc

Please sign in to comment.