@@ -536,13 +536,8 @@ public AllReader reader(LeafReaderContext context) throws IOException {
536536 case FLOAT -> {
537537 FloatVectorValues floatVectorValues = context .reader ().getFloatVectorValues (fieldName );
538538 if (floatVectorValues != null ) {
539- if (fieldType .isNormalized ()) {
540- NumericDocValues magnitudeDocValues = context .reader ()
541- .getNumericDocValues (fieldType .name () + COSINE_MAGNITUDE_FIELD_SUFFIX );
542- return new FloatDenseVectorNormalizedValuesBlockReader (floatVectorValues , dimensions , magnitudeDocValues );
543- }
539+ return new FloatDenseVectorValuesBlockReader (floatVectorValues , dimensions );
544540 }
545- return new FloatDenseVectorValuesBlockReader (floatVectorValues , dimensions );
546541 }
547542 case BYTE -> {
548543 ByteVectorValues byteVectorValues = context .reader ().getByteVectorValues (fieldName );
@@ -625,41 +620,6 @@ public String toString() {
625620 }
626621 }
627622
628- private static class FloatDenseVectorNormalizedValuesBlockReader extends DenseVectorValuesBlockReader <FloatVectorValues > {
629- private final NumericDocValues magnitudeDocValues ;
630-
631- FloatDenseVectorNormalizedValuesBlockReader (
632- FloatVectorValues floatVectorValues ,
633- int dimensions ,
634- NumericDocValues magnitudeDocValues
635- ) {
636- super (floatVectorValues , dimensions );
637- this .magnitudeDocValues = magnitudeDocValues ;
638- }
639-
640- @ Override
641- protected void appendDoc (BlockLoader .FloatBuilder builder ) throws IOException {
642- float [] floats = vectorValues .vectorValue (iterator .index ());
643- assert floats .length == dimensions
644- : "unexpected dimensions for vector value; expected " + dimensions + " but got " + floats .length ;
645-
646- float magnitude = 1.0f ;
647- // If all vectors are normalized, no doc values will be present. The vector may be normalized already, so we may not have a
648- // stored magnitude for all docs
649- if ((magnitudeDocValues != null ) && magnitudeDocValues .advanceExact (iterator .docID ())) {
650- magnitude = Float .intBitsToFloat ((int ) magnitudeDocValues .longValue ());
651- }
652- for (float aFloat : floats ) {
653- builder .appendFloat (aFloat * magnitude );
654- }
655- }
656-
657- @ Override
658- public String toString () {
659- return "BlockDocValuesReader.FloatDenseVectorNormalizedValuesBlockReader" ;
660- }
661- }
662-
663623 private static class ByteDenseVectorValuesBlockReader extends DenseVectorValuesBlockReader <ByteVectorValues > {
664624 ByteDenseVectorValuesBlockReader (ByteVectorValues floatVectorValues , int dimensions ) {
665625 super (floatVectorValues , dimensions );
0 commit comments