Skip to content

Commit d936652

Browse files
committed
test itr
1 parent 1dee562 commit d936652

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper.ElementType;
4848
import org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper.VectorSimilarity;
4949
import org.elasticsearch.index.query.SearchExecutionContext;
50+
import org.elasticsearch.nativeaccess.NativeAccess;
5051
import org.elasticsearch.search.lookup.Source;
5152
import org.elasticsearch.search.lookup.SourceProvider;
5253
import org.elasticsearch.search.vectors.VectorData;
@@ -2621,6 +2622,8 @@ public void testFloatVectorQueryBoundaries() throws IOException {
26212622
);
26222623
}
26232624

2625+
static final boolean optimizedScorer = NativeAccess.instance().getVectorSimilarityFunctions().isPresent();
2626+
26242627
public void testKnnVectorsFormat() throws IOException {
26252628
final int m = randomIntBetween(1, DEFAULT_MAX_CONN + 10);
26262629
final int efConstruction = randomIntBetween(1, DEFAULT_BEAM_WIDTH + 10);
@@ -2654,11 +2657,14 @@ public void testKnnVectorsFormat() throws IOException {
26542657
assertThat(codec, instanceOf(LegacyPerFieldMapperCodec.class));
26552658
knnVectorsFormat = ((LegacyPerFieldMapperCodec) codec).getKnnVectorsFormatForField("field");
26562659
}
2657-
String expectedString = "Lucene99HnswVectorsFormat(name=Lucene99HnswVectorsFormat, maxConn="
2660+
var expectedScorer = optimizedScorer
2661+
? "ESFlatVectorsScorer(delegate=DefaultFlatVectorScorer(), factory=VectorScorerFactoryImpl)"
2662+
: "DefaultFlatVectorScorer()";
2663+
String expectedString = "ES819HnswVectorsFormat(name=ES819HnswVectorsFormat, maxConn="
26582664
+ (setM ? m : DEFAULT_MAX_CONN)
26592665
+ ", beamWidth="
26602666
+ (setEfConstruction ? efConstruction : DEFAULT_BEAM_WIDTH)
2661-
+ ", flatVectorFormat=Lucene99FlatVectorsFormat(vectorsScorer=DefaultFlatVectorScorer())"
2667+
+ ", flatVectorFormat=Lucene99FlatVectorsFormat(vectorsScorer=%scorer%)".replace("%scorer%", expectedScorer)
26622668
+ ")";
26632669
assertEquals(expectedString, knnVectorsFormat.toString());
26642670
}

0 commit comments

Comments
 (0)