You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2023/01/04 18:02:02 UTC

[GitHub] [lucene] jpountz commented on a diff in pull request #12064: Create new KnnByteVectorField and KnnVectorsReader#getByteVectorValues(String)

jpountz commented on code in PR #12064:
URL: https://github.com/apache/lucene/pull/12064#discussion_r1061739690


##########
lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene94/Lucene94HnswVectorsReader.java:
##########
@@ -233,12 +234,19 @@ public void checkIntegrity() throws IOException {
   @Override
   public VectorValues getVectorValues(String field) throws IOException {
     FieldEntry fieldEntry = fields.get(field);
-    VectorValues values = OffHeapVectorValues.load(fieldEntry, vectorData);
-    if (fieldEntry.vectorEncoding == VectorEncoding.BYTE) {
-      return new ExpandingVectorValues(values);
-    } else {
-      return values;
+    if (fieldEntry.vectorEncoding != VectorEncoding.FLOAT32) {
+      return null;
     }
+    return OffHeapVectorValues.load(fieldEntry, vectorData);
+  }
+
+  @Override
+  public ByteVectorValues getByteVectorValues(String field) throws IOException {
+    FieldEntry fieldEntry = fields.get(field);
+    if (fieldEntry.vectorEncoding != VectorEncoding.BYTE) {
+      return null;
+    }

Review Comment:
   this `if` statement should be unnecessary since CodecReader already checks field infos? Can we fail hard if the encoding is not right instead of returning null?



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org