Pulkitg64 commented on code in PR #16687:
URL: https://github.com/apache/lucene/pull/16687#discussion_r4148453881
##########
lucene/core/src/test/org/apache/lucene/codecs/lucene104/TestLucene104HnswScalarQuantizedVectorsFormat.java:
##########
@@ -311,6 +329,164 @@ public void testSimpleOffHeapSize() throws IOException {
}
}
+ /**
+ * Verifies where merging gets the quantized scorer supplier used to build
the HNSW graph: from
+ * query data the flat writer prepared ({@link
+ *
Lucene104ScalarQuantizedVectorsWriter#mergeOneFlatVectorFieldForMergeScorer})
for asymmetric
+ * encodings, otherwise from {@link
+ *
Lucene104ScalarQuantizedVectorsReader#getRandomVectorScorerSupplierForMerge}.
+ */
+ public void testMergeScorer() throws IOException {
+ int dim = 8;
+
+ for (ScalarEncoding scalarEncoding : ScalarEncoding.values()) {
+ for (VectorEncoding vectorEncoding : VectorEncoding.values()) {
+ if (vectorEncoding.isFloatingPoint() == false) { // not applicable for
BYTE
+ continue;
+ }
+
+ MergeScorerCounts counts = new MergeScorerCounts();
+ IndexWriterConfig config =
+ newIndexWriterConfig()
+ .setCodec(
+ TestUtil.alwaysKnnVectorsFormat(
+ new MergeScorerCountingFormat(scalarEncoding, counts)))
+ .setMergeScheduler(new SerialMergeScheduler())
+ .setMergePolicy(NoMergePolicy.INSTANCE); // no merges while
indexing
+
+ try (Directory dir = newDirectory();
+ IndexWriter w = new IndexWriter(dir, config)) {
+ for (int i = 0; i < 2; i++) {
+ Document document = new Document();
+
+ IndexableField field =
+ switch (vectorEncoding) {
+ case BYTE -> new KnnByteVectorField("v", randomVector8(dim),
DOT_PRODUCT);
Review Comment:
Should we throw error in this branch because we don't expect BYTE
vectorEncoding?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]