6262
6363import static org .apache .lucene .codecs .KnnVectorsWriter .MergedVectorValues .hasVectorValues ;
6464import static org .apache .lucene .codecs .lucene99 .Lucene99HnswVectorsReader .SIMILARITY_FUNCTIONS ;
65- import static org .elasticsearch .index .codec .vectors .es910 .ES819HnswReducedHeapVectorsFormat .DIRECT_MONOTONIC_BLOCK_SHIFT ;
65+ import static org .elasticsearch .index .codec .vectors .es910 .ES910HnswReducedHeapVectorsFormat .DIRECT_MONOTONIC_BLOCK_SHIFT ;
6666
6767/**
6868 * Copied from Lucene, replace with Lucene's implementation sometime after Lucene 10.3.0
6969 */
7070@ SuppressForbidden (reason = "Lucene classes" )
71- public class ES819HnswReducedHeapVectorsWriter extends KnnVectorsWriter {
71+ public class ES910HnswReducedHeapVectorsWriter extends KnnVectorsWriter {
7272
73- private static final long SHALLOW_RAM_BYTES_USED = RamUsageEstimator .shallowSizeOfInstance (ES819HnswReducedHeapVectorsWriter .class );
73+ private static final long SHALLOW_RAM_BYTES_USED = RamUsageEstimator .shallowSizeOfInstance (ES910HnswReducedHeapVectorsWriter .class );
7474 private final SegmentWriteState segmentWriteState ;
7575 private final IndexOutput meta , vectorIndex ;
7676 private final int M ;
@@ -79,10 +79,10 @@ public class ES819HnswReducedHeapVectorsWriter extends KnnVectorsWriter {
7979 private final int numMergeWorkers ;
8080 private final TaskExecutor mergeExec ;
8181
82- private final List <ES819HnswReducedHeapVectorsWriter .FieldWriter <?>> fields = new ArrayList <>();
82+ private final List <ES910HnswReducedHeapVectorsWriter .FieldWriter <?>> fields = new ArrayList <>();
8383 private boolean finished ;
8484
85- public ES819HnswReducedHeapVectorsWriter (
85+ public ES910HnswReducedHeapVectorsWriter (
8686 SegmentWriteState state ,
8787 int M ,
8888 int beamWidth ,
@@ -100,13 +100,13 @@ public ES819HnswReducedHeapVectorsWriter(
100100 String metaFileName = IndexFileNames .segmentFileName (
101101 state .segmentInfo .name ,
102102 state .segmentSuffix ,
103- ES819HnswReducedHeapVectorsFormat .META_EXTENSION
103+ ES910HnswReducedHeapVectorsFormat .META_EXTENSION
104104 );
105105
106106 String indexDataFileName = IndexFileNames .segmentFileName (
107107 state .segmentInfo .name ,
108108 state .segmentSuffix ,
109- ES819HnswReducedHeapVectorsFormat .VECTOR_INDEX_EXTENSION
109+ ES910HnswReducedHeapVectorsFormat .VECTOR_INDEX_EXTENSION
110110 );
111111
112112 boolean success = false ;
@@ -116,14 +116,14 @@ public ES819HnswReducedHeapVectorsWriter(
116116
117117 CodecUtil .writeIndexHeader (
118118 meta ,
119- ES819HnswReducedHeapVectorsFormat .META_CODEC_NAME ,
119+ ES910HnswReducedHeapVectorsFormat .META_CODEC_NAME ,
120120 Lucene99HnswVectorsFormat .VERSION_CURRENT ,
121121 state .segmentInfo .getId (),
122122 state .segmentSuffix
123123 );
124124 CodecUtil .writeIndexHeader (
125125 vectorIndex ,
126- ES819HnswReducedHeapVectorsFormat .VECTOR_INDEX_CODEC_NAME ,
126+ ES910HnswReducedHeapVectorsFormat .VECTOR_INDEX_CODEC_NAME ,
127127 Lucene99HnswVectorsFormat .VERSION_CURRENT ,
128128 state .segmentInfo .getId (),
129129 state .segmentSuffix
@@ -138,7 +138,7 @@ public ES819HnswReducedHeapVectorsWriter(
138138
139139 @ Override
140140 public KnnFieldVectorsWriter <?> addField (FieldInfo fieldInfo ) throws IOException {
141- ES819HnswReducedHeapVectorsWriter .FieldWriter <?> newField = ES819HnswReducedHeapVectorsWriter .FieldWriter .create (
141+ ES910HnswReducedHeapVectorsWriter .FieldWriter <?> newField = ES910HnswReducedHeapVectorsWriter .FieldWriter .create (
142142 flatVectorWriter .getFlatVectorScorer (),
143143 flatVectorWriter .addField (fieldInfo ),
144144 fieldInfo ,
@@ -153,7 +153,7 @@ public KnnFieldVectorsWriter<?> addField(FieldInfo fieldInfo) throws IOException
153153 @ Override
154154 public void flush (int maxDoc , Sorter .DocMap sortMap ) throws IOException {
155155 flatVectorWriter .flush (maxDoc , sortMap );
156- for (ES819HnswReducedHeapVectorsWriter .FieldWriter <?> field : fields ) {
156+ for (ES910HnswReducedHeapVectorsWriter .FieldWriter <?> field : fields ) {
157157 if (sortMap == null ) {
158158 writeField (field );
159159 } else {
@@ -183,14 +183,14 @@ public void finish() throws IOException {
183183 @ Override
184184 public long ramBytesUsed () {
185185 long total = SHALLOW_RAM_BYTES_USED ;
186- for (ES819HnswReducedHeapVectorsWriter .FieldWriter <?> field : fields ) {
186+ for (ES910HnswReducedHeapVectorsWriter .FieldWriter <?> field : fields ) {
187187 // the field tracks the delegate field usage
188188 total += field .ramBytesUsed ();
189189 }
190190 return total ;
191191 }
192192
193- private void writeField (ES819HnswReducedHeapVectorsWriter .FieldWriter <?> fieldData ) throws IOException {
193+ private void writeField (ES910HnswReducedHeapVectorsWriter .FieldWriter <?> fieldData ) throws IOException {
194194 // write graph
195195 long vectorIndexOffset = vectorIndex .getFilePointer ();
196196 OnHeapHnswGraph graph = fieldData .getGraph ();
@@ -207,7 +207,7 @@ private void writeField(ES819HnswReducedHeapVectorsWriter.FieldWriter<?> fieldDa
207207 );
208208 }
209209
210- private void writeSortingField (ES819HnswReducedHeapVectorsWriter .FieldWriter <?> fieldData , Sorter .DocMap sortMap ) throws IOException {
210+ private void writeSortingField (ES910HnswReducedHeapVectorsWriter .FieldWriter <?> fieldData , Sorter .DocMap sortMap ) throws IOException {
211211 final int [] ordMap = new int [fieldData .getDocsWithFieldSet ().cardinality ()]; // new ord to old ord
212212 final int [] oldOrdMap = new int [fieldData .getDocsWithFieldSet ().cardinality ()]; // old ord to new ord
213213
@@ -540,7 +540,7 @@ static int distFuncToOrd(VectorSimilarityFunction func) {
540540 private static class FieldWriter <T > extends KnnFieldVectorsWriter <T > {
541541
542542 private static final long SHALLOW_SIZE = RamUsageEstimator .shallowSizeOfInstance (
543- ES819HnswReducedHeapVectorsWriter .FieldWriter .class
543+ ES910HnswReducedHeapVectorsWriter .FieldWriter .class
544544 );
545545
546546 private final FieldInfo fieldInfo ;
@@ -551,7 +551,7 @@ private static class FieldWriter<T> extends KnnFieldVectorsWriter<T> {
551551 private UpdateableRandomVectorScorer scorer ;
552552
553553 @ SuppressWarnings ("unchecked" )
554- static ES819HnswReducedHeapVectorsWriter .FieldWriter <?> create (
554+ static ES910HnswReducedHeapVectorsWriter .FieldWriter <?> create (
555555 FlatVectorsScorer scorer ,
556556 FlatFieldVectorsWriter <?> flatFieldVectorsWriter ,
557557 FieldInfo fieldInfo ,
@@ -560,15 +560,15 @@ static ES819HnswReducedHeapVectorsWriter.FieldWriter<?> create(
560560 InfoStream infoStream
561561 ) throws IOException {
562562 return switch (fieldInfo .getVectorEncoding ()) {
563- case BYTE -> new ES819HnswReducedHeapVectorsWriter .FieldWriter <>(
563+ case BYTE -> new ES910HnswReducedHeapVectorsWriter .FieldWriter <>(
564564 scorer ,
565565 (FlatFieldVectorsWriter <byte []>) flatFieldVectorsWriter ,
566566 fieldInfo ,
567567 M ,
568568 beamWidth ,
569569 infoStream
570570 );
571- case FLOAT32 -> new ES819HnswReducedHeapVectorsWriter .FieldWriter <>(
571+ case FLOAT32 -> new ES910HnswReducedHeapVectorsWriter .FieldWriter <>(
572572 scorer ,
573573 (FlatFieldVectorsWriter <float []>) flatFieldVectorsWriter ,
574574 fieldInfo ,
0 commit comments