benwtrent commented on code in PR #13525: URL: https://github.com/apache/lucene/pull/13525#discussion_r1691432866
########## lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatMultiVectorsFormat.java: ########## @@ -0,0 +1,109 @@ +/* + * 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.codecs.lucene99; + +import java.io.IOException; +import org.apache.lucene.codecs.hnsw.FlatVectorsFormat; +import org.apache.lucene.codecs.hnsw.FlatVectorsReader; +import org.apache.lucene.codecs.hnsw.FlatVectorsScorer; +import org.apache.lucene.codecs.hnsw.FlatVectorsWriter; +import org.apache.lucene.codecs.lucene90.IndexedDISI; +import org.apache.lucene.index.SegmentReadState; +import org.apache.lucene.index.SegmentWriteState; +import org.apache.lucene.search.DocIdSetIterator; +import org.apache.lucene.store.IndexOutput; + +/** + * Lucene 9.9 flat vector format, which encodes numeric vector values + * + * <h2>.vec (vector data) file</h2> + * + * <p>For each field: + * + * <ul> + * <li>Vector data ordered by field, document ordinal, and vector dimension. When the + * vectorEncoding is BYTE, each sample is stored as a single byte. When it is FLOAT32, each + * sample is stored as an IEEE float in little-endian byte order. + * <li>DocIds encoded by {@link IndexedDISI#writeBitSet(DocIdSetIterator, IndexOutput, byte)}, + * note that only in sparse case + * <li>OrdToDoc was encoded by {@link org.apache.lucene.util.packed.DirectMonotonicWriter}, note + * that only in sparse case + * <li>DataOffsets for variable length multi-vector values. Encoded by {@link + * org.apache.lucene.util.packed.DirectMonotonicWriter}, present only for multi-vectors + * </ul> + * + * <h2>.vemf (vector metadata) file</h2> + * + * <p>For each field: + * + * <ul> + * <li><b>[int32]</b> field number + * <li><b>[int32]</b> vector similarity function ordinal + * <li><b>[vlong]</b> offset to this field's vectors in the .vec file + * <li><b>[vlong]</b> length of this field's vectors, in bytes + * <li><b>[vint]</b> dimension of this field's vectors + * <li><b>[int]</b> the number of documents having values for this field + * <li><b>[int8]</b> if equals to -1, dense – all documents have values for a field. If equals to + * 0, sparse – some documents missing values. + * <li>DocIds were encoded by {@link IndexedDISI#writeBitSet(DocIdSetIterator, IndexOutput, byte)} + * <li>OrdToDoc was encoded by {@link org.apache.lucene.util.packed.DirectMonotonicWriter}, note + * that only in sparse case + * <li><b>[byte]</b> set to 1 if field has multi-vector values, 0 otherwise + * <li><b>[int]</b> multi-vector aggregation function ordinal, present only for multi-vectors + * <li>DataOffsets for variable length multi-vector values. Encoded by {@link + * org.apache.lucene.util.packed.DirectMonotonicWriter}, present only for multi-vectors + * </ul> + * + * @lucene.experimental + */ +// noCommit - pending tests +public final class Lucene99FlatMultiVectorsFormat extends FlatVectorsFormat { Review Comment: Why would I ever chose the single vector format? It seems like the multi-vector format would be optimized when there is only one vector per doc. Since we will support a dynamic number of vectors (of the same dimension) per doc, its conceivable that a segment, or an entire field, will just have one vector per doc. Why aren't we updating our existing formats to add support for multi-value vectors? -- 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