mingshl commented on code in PR #14729:
URL: https://github.com/apache/lucene/pull/14729#discussion_r2191078890


##########
lucene/core/src/java/org/apache/lucene/document/LateInteractionField.java:
##########
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.document;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+import org.apache.lucene.util.BytesRef;
+
+/**
+ * A field for storing multi-vector values for late interaction models.
+ *
+ * <p>The value is stored as a binary payload, and can be retrieved using 
{@link
+ * LateInteractionField#decode(BytesRef)}. Multi-vectors are expected to have 
the same dimension for
+ * each composing token vector. This is stored along with the token vectors in 
the first 4 bytes of
+ * the payload.
+ *
+ * <p>Note: This field does not ensure consistency in token vector dimensions 
for values across
+ * documents.
+ */
+public class LateInteractionField extends BinaryDocValuesField {
+
+  /**
+   * Creates a new {@link LateInteractionField} from the provided multi-vector 
matrix.
+   *
+   * @param name field name
+   * @param value multi-vector value
+   */
+  public LateInteractionField(String name, float[][] value) {

Review Comment:
   I have a question about this `LateInteractionField` which stores the value 
with an nested array of float. When it stores, will it be the same as ?
   
   ```
   PUT test_float_array/_doc/1
   {
     "review_colbert_vectors": [
       [
         0.123,
         0.234,
         0.345,
         0.456,
         0.567,
         0.678,
         0.789,
         0.123
       ],
       [
         0.123,
         0.234,
         0.345,
         0.456,
         0.567,
         0.678,
         0.789,
         0.123
       ],
       [
         0.234,
         0.234,
         0.345,
         0.456,
         0.567,
         0.678,
         0.789,
         0.123
       ],
       [
         0.345,
         0.345,
         0.345,
         0.456,
         0.567,
         0.678,
         0.789,
         0.123
       ]
     ]
   }
   
   GET test_float_array/_doc/1
   {
     "_index": "test_float_array",
     "_id": "1",
     "_version": 1,
     "_seq_no": 0,
     "_primary_term": 1,
     "found": true,
     "_source": {
       "review_colbert_vectors": [
         [
           0.123,
           0.234,
           0.345,
           0.456,
           0.567,
           0.678,
           0.789,
           0.123
         ],
         [
           0.123,
           0.234,
           0.345,
           0.456,
           0.567,
           0.678,
           0.789,
           0.123
         ],
         [
           0.234,
           0.234,
           0.345,
           0.456,
           0.567,
           0.678,
           0.789,
           0.123
         ],
         [
           0.345,
           0.345,
           0.345,
           0.456,
           0.567,
           0.678,
           0.789,
           0.123
         ]
       ]
     }
   }
   ```



-- 
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-unsubscr...@lucene.apache.org

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


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

Reply via email to