msokolov commented on code in PR #16383:
URL: https://github.com/apache/lucene/pull/16383#discussion_r3646033780


##########
lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsWriter.java:
##########
@@ -92,6 +93,28 @@ private void writeFloatVectorValue(FloatVectorValues 
vectors, int ord) throws IO
     newline(vectorData);
   }
 
+  @Override
+  public void writeField(FieldInfo fieldInfo, Float16VectorValues 
float16VectorValues, int maxDoc)
+      throws IOException {
+    long vectorDataOffset = vectorData.getFilePointer();
+    List<Integer> docIds = new ArrayList<>();
+    KnnVectorValues.DocIndexIterator iter = float16VectorValues.iterator();
+    for (int docV = iter.nextDoc(); docV != NO_MORE_DOCS; docV = 
iter.nextDoc()) {
+      writeFloat16VectorValue(float16VectorValues, iter.index());
+      docIds.add(docV);
+    }
+    long vectorDataLength = vectorData.getFilePointer() - vectorDataOffset;
+    writeMeta(fieldInfo, vectorDataOffset, vectorDataLength, docIds);
+  }
+
+  private void writeFloat16VectorValue(Float16VectorValues vectors, int ord) 
throws IOException {
+    // write vector value
+    short[] value = vectors.vectorValue(ord);
+    assert value.length == vectors.dimension();
+    write(vectorData, Arrays.toString(value));

Review Comment:
   I mean the behavior is correct either way, so we're just discussing what the 
serialization format should be, right? I think printing and reading floating 
point numbers is notoriously messy and would prefer sticking to short-int in 
the printed format to avoid that?



-- 
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]

Reply via email to