Skip to content

Commit cc9a0f8

Browse files
cpoerschkeIshan Chattopadhyayanoblepaul
authored
remove deprecated KnnVectorField use (#3121)
Co-authored-by: Ishan Chattopadhyaya <[email protected]> Co-authored-by: noblepaul <[email protected]>
1 parent b32b675 commit cc9a0f8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

solr/core/src/java/org/apache/solr/schema/DenseVectorField.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@
5252
import org.slf4j.LoggerFactory;
5353

5454
/**
55-
* Provides a field type to support Lucene's {@link org.apache.lucene.document.KnnVectorField}. See
56-
* {@link org.apache.lucene.search.KnnVectorQuery} for more details. It supports a fixed cardinality
55+
* Provides a field type to support Lucene's {@link org.apache.lucene.document.KnnByteVectorField}
56+
* and {@link org.apache.lucene.document.KnnFloatVectorField}. See {@link
57+
* org.apache.lucene.search.KnnByteVectorQuery} and {@link
58+
* org.apache.lucene.search.KnnFloatVectorQuery} for more details. It supports a fixed cardinality
5759
* dimension for the vector and a fixed similarity function. The default similarity is
5860
* EUCLIDEAN_HNSW (L2). The default algorithm is HNSW. For Lucene 9.1 e.g. See {@link
5961
* org.apache.lucene.util.hnsw.HnswGraph} for more details about the implementation. <br>

solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.stream.StreamSupport;
2727
import org.apache.lucene.document.Document;
2828
import org.apache.lucene.document.KnnFloatVectorField;
29-
import org.apache.lucene.document.KnnVectorField;
3029
import org.apache.lucene.index.IndexableField;
3130
import org.apache.lucene.index.VectorSimilarityFunction;
3231
import org.apache.lucene.tests.util.TestUtil;
@@ -352,8 +351,8 @@ public void denseVector_shouldReturnOneIndexableFieldAndOneStoredFieldPerVectorE
352351
Document out = DocumentBuilder.toDocument(doc, core.getLatestSchema());
353352

354353
// from /solr/core/src/test-files/solr/collection1/conf/schema.xml
355-
KnnVectorField expectedIndexableField =
356-
new KnnVectorField(
354+
KnnFloatVectorField expectedIndexableField =
355+
new KnnFloatVectorField(
357356
"vector", new float[] {1.1f, 2.1f, 3.1f, 4.1f}, VectorSimilarityFunction.COSINE);
358357

359358
assertThat(
@@ -383,8 +382,8 @@ public void denseVector_shouldWorkWithCopyFields() {
383382
Document out = DocumentBuilder.toDocument(doc, core.getLatestSchema());
384383

385384
// from /solr/core/src/test-files/solr/collection1/conf/schema.xml
386-
KnnVectorField expectedDestination =
387-
new KnnVectorField(
385+
KnnFloatVectorField expectedDestination =
386+
new KnnFloatVectorField(
388387
"vector2", new float[] {1.1f, 2.1f, 3.1f, 4.1f}, VectorSimilarityFunction.DOT_PRODUCT);
389388

390389
assertThat(

solr/core/src/test/org/apache/solr/update/DocumentBuilderVectorCatchAllCopyTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.stream.StreamSupport;
2525
import org.apache.lucene.document.Document;
2626
import org.apache.lucene.document.KnnFloatVectorField;
27-
import org.apache.lucene.document.KnnVectorField;
2827
import org.apache.lucene.index.IndexableField;
2928
import org.apache.lucene.index.VectorSimilarityFunction;
3029
import org.apache.solr.SolrTestCaseJ4;
@@ -54,8 +53,8 @@ public void denseVector_shouldWorkWithCatchAllCopyFields() {
5453
Document out = DocumentBuilder.toDocument(doc, core.getLatestSchema());
5554

5655
// from /solr/core/src/test-files/solr/collection1/conf/schema.xml
57-
KnnVectorField expectedDestination =
58-
new KnnVectorField(
56+
KnnFloatVectorField expectedDestination =
57+
new KnnFloatVectorField(
5958
"vector2", new float[] {1.1f, 2.1f, 3.1f, 4.1f}, VectorSimilarityFunction.DOT_PRODUCT);
6059

6160
assertThat(

0 commit comments

Comments
 (0)