You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2022/06/29 09:37:45 UTC

[lucene] branch branch_9x updated (0f310bda2b7 -> b3b7098cd96)

This is an automated email from the ASF dual-hosted git repository.

abenedetti pushed a change to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


    from 0f310bda2b7 Update randomizedtesting to 2.8.0, hppc to 0.9.1, morfologik to 2.1.9. (#991)
     new f4f4a159b77 Create Lucene93 Codec and move Lucene92 to backwards_codecs (#924)
     new b3b7098cd96 LUCENE-10593: VectorSimilarityFunction reverse removal (#926)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 lucene/CHANGES.txt                                 |  2 +
 lucene/backward-codecs/src/java/module-info.java   |  7 ++-
 .../lucene90/Lucene90BoundsChecker.java}           | 27 ++++++++---
 .../lucene90/Lucene90HnswGraphBuilder.java         | 20 ++++----
 .../lucene90/Lucene90HnswVectorsReader.java        |  4 +-
 .../lucene90/Lucene90OnHeapHnswGraph.java          | 19 ++++----
 .../lucene91/Lucene91BoundsChecker.java}           | 27 ++++++++---
 .../lucene91/Lucene91HnswGraphBuilder.java         | 25 +++++-----
 .../lucene91/Lucene91HnswVectorsReader.java        |  4 +-
 .../backward_codecs}/lucene92/Lucene92Codec.java   |  6 +--
 .../lucene92/Lucene92HnswVectorsFormat.java        | 36 +++++++--------
 .../lucene92/Lucene92HnswVectorsReader.java        |  6 +--
 .../lucene92/OffHeapVectorValues.java              |  2 +-
 .../backward_codecs}/lucene92/package-info.java    |  8 ++--
 .../services/org.apache.lucene.codecs.Codec        |  1 +
 .../org.apache.lucene.codecs.KnnVectorsFormat      |  1 +
 .../lucene92/Lucene92HnswVectorsWriter.java        |  4 +-
 .../Lucene92RWCodec.java}                          | 18 ++++----
 .../Lucene92RWHnswVectorsFormat.java}              | 19 ++++++--
 .../TestLucene92HnswVectorsFormat.java}            | 24 +++-------
 .../benchmark/byTask/tasks/CreateIndexTask.java    |  4 +-
 .../simpletext/SimpleTextKnnVectorsReader.java     |  2 +-
 lucene/core/src/java/module-info.java              | 10 ++--
 .../src/java/org/apache/lucene/codecs/Codec.java   |  2 +-
 .../org/apache/lucene/codecs/KnnVectorsFormat.java |  3 +-
 .../Lucene93Codec.java}                            | 24 +++++-----
 .../Lucene93HnswVectorsFormat.java}                | 35 ++++++++------
 .../Lucene93HnswVectorsReader.java}                | 30 ++++++------
 .../Lucene93HnswVectorsWriter.java}                | 28 +++++------
 .../OffHeapVectorValues.java                       |  8 ++--
 .../{lucene92 => lucene93}/package-info.java       |  8 ++--
 .../lucene/index/VectorSimilarityFunction.java     | 52 +++------------------
 .../org/apache/lucene/search/KnnVectorQuery.java   |  2 +-
 .../apache/lucene/util/hnsw/HnswGraphBuilder.java  | 24 +++++-----
 .../apache/lucene/util/hnsw/HnswGraphSearcher.java | 22 ++++-----
 .../org/apache/lucene/util/hnsw/NeighborQueue.java | 54 ++++++++++++++++++----
 .../apache/lucene/util/hnsw/OnHeapHnswGraph.java   | 10 ++--
 .../services/org.apache.lucene.codecs.Codec        |  2 +-
 .../org.apache.lucene.codecs.KnnVectorsFormat      |  2 +-
 ...tLucene90StoredFieldsFormatHighCompression.java | 10 ++--
 .../test/org/apache/lucene/index/TestKnnGraph.java | 22 ++++-----
 .../apache/lucene/util/hnsw/KnnGraphTester.java    | 17 ++++---
 .../org/apache/lucene/util/hnsw/TestHnswGraph.java | 38 +++------------
 .../search/suggest/document/TestSuggestField.java  |  4 +-
 .../util/TestRuleSetupAndRestoreClassEnv.java      |  8 ++--
 .../org/apache/lucene/tests/util/TestUtil.java     |  8 ++--
 46 files changed, 346 insertions(+), 343 deletions(-)
 copy lucene/{core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java => backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90BoundsChecker.java} (77%)
 rename lucene/{core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java => backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91BoundsChecker.java} (77%)
 copy lucene/{core/src/java/org/apache/lucene/codecs => backward-codecs/src/java/org/apache/lucene/backward_codecs}/lucene92/Lucene92Codec.java (97%)
 copy lucene/{core/src/java/org/apache/lucene/codecs => backward-codecs/src/java/org/apache/lucene/backward_codecs}/lucene92/Lucene92HnswVectorsFormat.java (90%)
 copy lucene/{core/src/java/org/apache/lucene/codecs => backward-codecs/src/java/org/apache/lucene/backward_codecs}/lucene92/Lucene92HnswVectorsReader.java (99%)
 copy lucene/{core/src/java/org/apache/lucene/codecs => backward-codecs/src/java/org/apache/lucene/backward_codecs}/lucene92/OffHeapVectorValues.java (99%)
 copy lucene/{core/src/java/org/apache/lucene/codecs => backward-codecs/src/java/org/apache/lucene/backward_codecs}/lucene92/package-info.java (98%)
 copy lucene/{core/src/java/org/apache/lucene/codecs => backward-codecs/src/test/org/apache/lucene/backward_codecs}/lucene92/Lucene92HnswVectorsWriter.java (98%)
 copy lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/{lucene90/Lucene90RWCodec.java => lucene92/Lucene92RWCodec.java} (72%)
 copy lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/{lucene91/Lucene91RWHnswVectorsFormat.java => lucene92/Lucene92RWHnswVectorsFormat.java} (65%)
 copy lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/{lucene91/TestLucene91HnswVectorsFormat.java => lucene92/TestLucene92HnswVectorsFormat.java} (57%)
 rename lucene/core/src/java/org/apache/lucene/codecs/{lucene92/Lucene92Codec.java => lucene93/Lucene93Codec.java} (92%)
 rename lucene/core/src/java/org/apache/lucene/codecs/{lucene92/Lucene92HnswVectorsFormat.java => lucene93/Lucene93HnswVectorsFormat.java} (83%)
 rename lucene/core/src/java/org/apache/lucene/codecs/{lucene92/Lucene92HnswVectorsReader.java => lucene93/Lucene93HnswVectorsReader.java} (94%)
 rename lucene/core/src/java/org/apache/lucene/codecs/{lucene92/Lucene92HnswVectorsWriter.java => lucene93/Lucene93HnswVectorsWriter.java} (93%)
 rename lucene/core/src/java/org/apache/lucene/codecs/{lucene92 => lucene93}/OffHeapVectorValues.java (97%)
 rename lucene/core/src/java/org/apache/lucene/codecs/{lucene92 => lucene93}/package-info.java (99%)


[lucene] 01/02: Create Lucene93 Codec and move Lucene92 to backwards_codecs (#924)

Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

abenedetti pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit f4f4a159b77ffca974c003aba5d6b33a3b40be97
Author: Michael Sokolov <so...@falutin.net>
AuthorDate: Tue May 31 17:05:12 2022 -0400

    Create Lucene93 Codec and move Lucene92 to backwards_codecs (#924)
---
 lucene/backward-codecs/src/java/module-info.java   |  7 ++-
 .../backward_codecs}/lucene92/Lucene92Codec.java   |  6 +--
 .../lucene92/Lucene92HnswVectorsFormat.java        | 36 +++++++--------
 .../lucene92/Lucene92HnswVectorsReader.java        |  2 +-
 .../lucene92/OffHeapVectorValues.java              |  2 +-
 .../backward_codecs}/lucene92/package-info.java    |  8 ++--
 .../services/org.apache.lucene.codecs.Codec        |  1 +
 .../org.apache.lucene.codecs.KnnVectorsFormat      |  1 +
 .../lucene92/Lucene92HnswVectorsWriter.java        |  4 +-
 .../backward_codecs/lucene92/Lucene92RWCodec.java  | 46 +++++++++++++++++++
 .../lucene92/Lucene92RWHnswVectorsFormat.java      | 52 ++++++++++++++++++++++
 .../lucene92/TestLucene92HnswVectorsFormat.java    | 43 ++++++++++++++++++
 .../benchmark/byTask/tasks/CreateIndexTask.java    |  4 +-
 lucene/core/src/java/module-info.java              | 10 ++---
 .../src/java/org/apache/lucene/codecs/Codec.java   |  2 +-
 .../org/apache/lucene/codecs/KnnVectorsFormat.java |  3 +-
 .../Lucene93Codec.java}                            | 24 +++++-----
 .../Lucene93HnswVectorsFormat.java}                | 35 +++++++++------
 .../Lucene93HnswVectorsReader.java}                | 28 ++++++------
 .../Lucene93HnswVectorsWriter.java}                | 28 ++++++------
 .../OffHeapVectorValues.java                       |  8 ++--
 .../{lucene92 => lucene93}/package-info.java       |  8 ++--
 .../services/org.apache.lucene.codecs.Codec        |  2 +-
 .../org.apache.lucene.codecs.KnnVectorsFormat      |  2 +-
 ...tLucene90StoredFieldsFormatHighCompression.java | 10 ++---
 .../test/org/apache/lucene/index/TestKnnGraph.java | 22 ++++-----
 .../apache/lucene/util/hnsw/KnnGraphTester.java    | 12 ++---
 .../org/apache/lucene/util/hnsw/TestHnswGraph.java | 12 ++---
 .../search/suggest/document/TestSuggestField.java  |  4 +-
 .../util/TestRuleSetupAndRestoreClassEnv.java      |  8 ++--
 .../org/apache/lucene/tests/util/TestUtil.java     |  8 ++--
 31 files changed, 295 insertions(+), 143 deletions(-)

diff --git a/lucene/backward-codecs/src/java/module-info.java b/lucene/backward-codecs/src/java/module-info.java
index 01e948d4d82..cdbc3795ea4 100644
--- a/lucene/backward-codecs/src/java/module-info.java
+++ b/lucene/backward-codecs/src/java/module-info.java
@@ -31,6 +31,7 @@ module org.apache.lucene.backward_codecs {
   exports org.apache.lucene.backward_codecs.lucene87;
   exports org.apache.lucene.backward_codecs.lucene90;
   exports org.apache.lucene.backward_codecs.lucene91;
+  exports org.apache.lucene.backward_codecs.lucene92;
   exports org.apache.lucene.backward_codecs.packed;
   exports org.apache.lucene.backward_codecs.store;
 
@@ -42,7 +43,8 @@ module org.apache.lucene.backward_codecs {
       org.apache.lucene.backward_codecs.lucene84.Lucene84PostingsFormat;
   provides org.apache.lucene.codecs.KnnVectorsFormat with
       org.apache.lucene.backward_codecs.lucene90.Lucene90HnswVectorsFormat,
-      org.apache.lucene.backward_codecs.lucene91.Lucene91HnswVectorsFormat;
+      org.apache.lucene.backward_codecs.lucene91.Lucene91HnswVectorsFormat,
+      org.apache.lucene.backward_codecs.lucene92.Lucene92HnswVectorsFormat;
   provides org.apache.lucene.codecs.Codec with
       org.apache.lucene.backward_codecs.lucene70.Lucene70Codec,
       org.apache.lucene.backward_codecs.lucene80.Lucene80Codec,
@@ -50,5 +52,6 @@ module org.apache.lucene.backward_codecs {
       org.apache.lucene.backward_codecs.lucene86.Lucene86Codec,
       org.apache.lucene.backward_codecs.lucene87.Lucene87Codec,
       org.apache.lucene.backward_codecs.lucene90.Lucene90Codec,
-      org.apache.lucene.backward_codecs.lucene91.Lucene91Codec;
+      org.apache.lucene.backward_codecs.lucene91.Lucene91Codec,
+      org.apache.lucene.backward_codecs.lucene92.Lucene92Codec;
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92Codec.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92Codec.java
similarity index 97%
copy from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92Codec.java
copy to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92Codec.java
index 5264295a902..f8245d8b3ea 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92Codec.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92Codec.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.backward_codecs.lucene92;
 
 import java.util.Objects;
 import org.apache.lucene.codecs.Codec;
@@ -49,7 +49,7 @@ import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
  *
  * <p>If you want to reuse functionality of this codec in another codec, extend {@link FilterCodec}.
  *
- * @see org.apache.lucene.codecs.lucene92 package documentation for file format details.
+ * @see org.apache.lucene.backward_codecs.lucene92 package documentation for file format details.
  * @lucene.experimental
  */
 public class Lucene92Codec extends Codec {
@@ -164,7 +164,7 @@ public class Lucene92Codec extends Codec {
   }
 
   @Override
-  public final KnnVectorsFormat knnVectorsFormat() {
+  public KnnVectorsFormat knnVectorsFormat() {
     return knnVectorsFormat;
   }
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsFormat.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsFormat.java
similarity index 90%
copy from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsFormat.java
copy to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsFormat.java
index 3b28b706890..a3efe347568 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsFormat.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsFormat.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.backward_codecs.lucene92;
 
 import java.io.IOException;
 import org.apache.lucene.codecs.KnnVectorsFormat;
@@ -95,7 +95,15 @@ import org.apache.lucene.util.hnsw.HnswGraph;
  *
  * @lucene.experimental
  */
-public final class Lucene92HnswVectorsFormat extends KnnVectorsFormat {
+public class Lucene92HnswVectorsFormat extends KnnVectorsFormat {
+
+  /** Default number of maximum connections per node */
+  public static final int DEFAULT_MAX_CONN = 16;
+
+  /**
+   * Default number of the size of the queue maintained while searching during a graph construction.
+   */
+  public static final int DEFAULT_BEAM_WIDTH = 100;
 
   static final String META_CODEC_NAME = "lucene92HnswVectorsFormatMeta";
   static final String VECTOR_DATA_CODEC_NAME = "lucene92HnswVectorsFormatData";
@@ -107,32 +115,24 @@ public final class Lucene92HnswVectorsFormat extends KnnVectorsFormat {
   static final int VERSION_START = 0;
   static final int VERSION_CURRENT = VERSION_START;
 
-  /** Default number of maximum connections per node */
-  public static final int DEFAULT_MAX_CONN = 16;
-  /**
-   * Default number of the size of the queue maintained while searching during a graph construction.
-   */
-  public static final int DEFAULT_BEAM_WIDTH = 100;
-
-  static final int DIRECT_MONOTONIC_BLOCK_SHIFT = 16;
-
   /**
    * Controls how many of the nearest neighbor candidates are connected to the new node. Defaults to
-   * {@link Lucene92HnswVectorsFormat#DEFAULT_MAX_CONN}. See {@link HnswGraph} for more details.
+   * {@link #maxConn}. See {@link HnswGraph} for more details.
    */
-  private final int maxConn;
+  final int maxConn;
 
   /**
    * The number of candidate neighbors to track while searching the graph for each newly inserted
-   * node. Defaults to to {@link Lucene92HnswVectorsFormat#DEFAULT_BEAM_WIDTH}. See {@link
-   * HnswGraph} for details.
+   * node. Defaults to to {@link #DEFAULT_BEAM_WIDTH}. See {@link HnswGraph} for details.
    */
-  private final int beamWidth;
+  final int beamWidth;
 
+  /** A constructor for vectors format with default parameters */
   public Lucene92HnswVectorsFormat() {
     this(DEFAULT_MAX_CONN, DEFAULT_BEAM_WIDTH);
   }
 
+  /** Constructs a format for reading old indexes */
   public Lucene92HnswVectorsFormat(int maxConn, int beamWidth) {
     super("lucene92HnswVectorsFormat");
     this.maxConn = maxConn;
@@ -141,7 +141,7 @@ public final class Lucene92HnswVectorsFormat extends KnnVectorsFormat {
 
   @Override
   public KnnVectorsWriter fieldsWriter(SegmentWriteState state) throws IOException {
-    return new Lucene92HnswVectorsWriter(state, maxConn, beamWidth);
+    throw new UnsupportedOperationException("Old codecs may only be used for reading");
   }
 
   @Override
@@ -151,7 +151,7 @@ public final class Lucene92HnswVectorsFormat extends KnnVectorsFormat {
 
   @Override
   public String toString() {
-    return "lucene92HnswVectorsFormat(name = lucene92HnswVectorsFormat, maxConn = "
+    return "Lucene92HnswVectorsFormat(name = Lucene92HnswVectorsFormat, maxConn = "
         + maxConn
         + ", beamWidth="
         + beamWidth
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsReader.java
similarity index 99%
copy from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsReader.java
copy to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsReader.java
index 70ceab4c5be..4e9a6a2dd3b 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsReader.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsReader.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.backward_codecs.lucene92;
 
 import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/OffHeapVectorValues.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/OffHeapVectorValues.java
similarity index 99%
copy from lucene/core/src/java/org/apache/lucene/codecs/lucene92/OffHeapVectorValues.java
copy to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/OffHeapVectorValues.java
index 199df605fe0..694903c2147 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/OffHeapVectorValues.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/OffHeapVectorValues.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.backward_codecs.lucene92;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/package-info.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/package-info.java
similarity index 98%
copy from lucene/core/src/java/org/apache/lucene/codecs/lucene92/package-info.java
copy to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/package-info.java
index f87fd0f2995..cb06d56fd71 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/package-info.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/package-info.java
@@ -180,8 +180,8 @@
  *       of files, recording dimensionally indexed fields, to enable fast numeric range filtering
  *       and large numeric values like BigInteger and BigDecimal (1D) and geographic shape
  *       intersection (2D, 3D).
- *   <li>{@link org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat Vector values}. The
- *       vector format stores numeric vectors in a format optimized for random access and
+ *   <li>{@link org.apache.lucene.backward_codecs.lucene92.Lucene92HnswVectorsFormat Vector values}.
+ *       The vector format stores numeric vectors in a format optimized for random access and
  *       computation, supporting high-dimensional nearest-neighbor search.
  * </ul>
  *
@@ -310,7 +310,7 @@
  * <td>Holds indexed points</td>
  * </tr>
  * <tr>
- * <td>{@link org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat Vector values}</td>
+ * <td>{@link org.apache.lucene.backward_codecs.lucene92.Lucene92HnswVectorsFormat Vector values}</td>
  * <td>.vec, .vem</td>
  * <td>Holds indexed vectors; <code>.vec</code> files contain the raw vector data, and
  * <code>.vem</code> the vector metadata</td>
@@ -419,4 +419,4 @@
  * <code>UInt64</code> values, or better yet, {@link org.apache.lucene.store.DataOutput#writeVInt
  * VInt} values which have no limit. </div>
  */
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.backward_codecs.lucene92;
diff --git a/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec b/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec
index 1a7432e3bf6..66db91597cf 100644
--- a/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec
+++ b/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec
@@ -20,3 +20,4 @@ org.apache.lucene.backward_codecs.lucene87.Lucene87Codec
 org.apache.lucene.backward_codecs.lucene70.Lucene70Codec
 org.apache.lucene.backward_codecs.lucene90.Lucene90Codec
 org.apache.lucene.backward_codecs.lucene91.Lucene91Codec
+org.apache.lucene.backward_codecs.lucene92.Lucene92Codec
diff --git a/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat b/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat
index 550912cbf86..037584b0318 100644
--- a/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat
+++ b/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat
@@ -15,3 +15,4 @@
 
 org.apache.lucene.backward_codecs.lucene90.Lucene90HnswVectorsFormat
 org.apache.lucene.backward_codecs.lucene91.Lucene91HnswVectorsFormat
+org.apache.lucene.backward_codecs.lucene92.Lucene92HnswVectorsFormat
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsWriter.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsWriter.java
similarity index 98%
copy from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsWriter.java
copy to lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsWriter.java
index e63ab2ce277..98e397084a8 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsWriter.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsWriter.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.backward_codecs.lucene92;
 
-import static org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat.DIRECT_MONOTONIC_BLOCK_SHIFT;
+import static org.apache.lucene.backward_codecs.lucene92.Lucene92RWHnswVectorsFormat.DIRECT_MONOTONIC_BLOCK_SHIFT;
 import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
 
 import java.io.IOException;
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92RWCodec.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92RWCodec.java
new file mode 100644
index 00000000000..65ca5257d63
--- /dev/null
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92RWCodec.java
@@ -0,0 +1,46 @@
+/*
+ * 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.backward_codecs.lucene92;
+
+import org.apache.lucene.codecs.KnnVectorsFormat;
+import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
+
+/** Implements the Lucene 9.2 index format for backwards compat testing */
+public class Lucene92RWCodec extends Lucene92Codec {
+
+  private final KnnVectorsFormat defaultKnnVectorsFormat;
+  private final KnnVectorsFormat knnVectorsFormat =
+      new PerFieldKnnVectorsFormat() {
+        @Override
+        public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
+          return defaultKnnVectorsFormat;
+        }
+      };
+
+  /** Instantiates a new codec. */
+  public Lucene92RWCodec() {
+    defaultKnnVectorsFormat =
+        new Lucene92RWHnswVectorsFormat(
+            Lucene92HnswVectorsFormat.DEFAULT_MAX_CONN,
+            Lucene92HnswVectorsFormat.DEFAULT_BEAM_WIDTH);
+  }
+
+  @Override
+  public final KnnVectorsFormat knnVectorsFormat() {
+    return knnVectorsFormat;
+  }
+}
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92RWHnswVectorsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92RWHnswVectorsFormat.java
new file mode 100644
index 00000000000..3b72fa3fe9a
--- /dev/null
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/Lucene92RWHnswVectorsFormat.java
@@ -0,0 +1,52 @@
+/*
+ * 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.backward_codecs.lucene92;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.KnnVectorsReader;
+import org.apache.lucene.codecs.KnnVectorsWriter;
+import org.apache.lucene.index.SegmentReadState;
+import org.apache.lucene.index.SegmentWriteState;
+
+public final class Lucene92RWHnswVectorsFormat extends Lucene92HnswVectorsFormat {
+
+  static final int DIRECT_MONOTONIC_BLOCK_SHIFT = 16;
+
+  public Lucene92RWHnswVectorsFormat(int maxConn, int beamWidth) {
+    super(maxConn, beamWidth);
+  }
+
+  @Override
+  public KnnVectorsWriter fieldsWriter(SegmentWriteState state) throws IOException {
+    return new Lucene92HnswVectorsWriter(state, DEFAULT_MAX_CONN, DEFAULT_BEAM_WIDTH);
+  }
+
+  @Override
+  public KnnVectorsReader fieldsReader(SegmentReadState state) throws IOException {
+    return new Lucene92HnswVectorsReader(state);
+  }
+
+  @Override
+  public String toString() {
+    return "Lucene92RWHnswVectorsFormat(name = Lucene92RWHnswVectorsFormat, maxConn = "
+        + maxConn
+        + ", beamWidth="
+        + beamWidth
+        + ")";
+  }
+}
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/TestLucene92HnswVectorsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/TestLucene92HnswVectorsFormat.java
new file mode 100644
index 00000000000..3984bb36619
--- /dev/null
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene92/TestLucene92HnswVectorsFormat.java
@@ -0,0 +1,43 @@
+/*
+ * 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.backward_codecs.lucene92;
+
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.KnnVectorsFormat;
+import org.apache.lucene.tests.index.BaseKnnVectorsFormatTestCase;
+
+public class TestLucene92HnswVectorsFormat extends BaseKnnVectorsFormatTestCase {
+  @Override
+  protected Codec getCodec() {
+    return new Lucene92RWCodec();
+  }
+
+  public void testToString() {
+    Codec customCodec =
+        new Lucene92RWCodec() {
+          @Override
+          public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
+            return new Lucene92RWHnswVectorsFormat(10, 20);
+          }
+        };
+    String expectedString =
+        "Lucene92RWHnswVectorsFormat(name = Lucene92RWHnswVectorsFormat, maxConn = 10, beamWidth=20)";
+    assertEquals(
+        expectedString,
+        ((Lucene92Codec) customCodec).getKnnVectorsFormatForField("bogus_field").toString());
+  }
+}
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
index e21fabe9e5f..8cba894d798 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
@@ -27,7 +27,7 @@ import org.apache.lucene.benchmark.byTask.PerfRunData;
 import org.apache.lucene.benchmark.byTask.utils.Config;
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.codecs.PostingsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
 import org.apache.lucene.index.ConcurrentMergeScheduler;
 import org.apache.lucene.index.IndexCommit;
 import org.apache.lucene.index.IndexDeletionPolicy;
@@ -152,7 +152,7 @@ public class CreateIndexTask extends PerfTask {
       try {
         final PostingsFormat postingsFormatChosen = PostingsFormat.forName(postingsFormat);
         iwConf.setCodec(
-            new Lucene92Codec() {
+            new Lucene93Codec() {
               @Override
               public PostingsFormat getPostingsFormatForField(String field) {
                 return postingsFormatChosen;
diff --git a/lucene/core/src/java/module-info.java b/lucene/core/src/java/module-info.java
index cbb5c3a3147..6a3e9692a64 100644
--- a/lucene/core/src/java/module-info.java
+++ b/lucene/core/src/java/module-info.java
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat;
 
 /** Lucene Core. */
 @SuppressWarnings("module") // the test framework is compiled after the core...
@@ -31,7 +31,7 @@ module org.apache.lucene.core {
   exports org.apache.lucene.codecs;
   exports org.apache.lucene.codecs.compressing;
   exports org.apache.lucene.codecs.lucene90;
-  exports org.apache.lucene.codecs.lucene92;
+  exports org.apache.lucene.codecs.lucene93;
   exports org.apache.lucene.codecs.lucene90.blocktree;
   exports org.apache.lucene.codecs.lucene90.compressing;
   exports org.apache.lucene.codecs.perfield;
@@ -63,11 +63,11 @@ module org.apache.lucene.core {
   provides org.apache.lucene.analysis.TokenizerFactory with
       org.apache.lucene.analysis.standard.StandardTokenizerFactory;
   provides org.apache.lucene.codecs.Codec with
-      Lucene92Codec;
+      Lucene93Codec;
   provides org.apache.lucene.codecs.DocValuesFormat with
       org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
   provides org.apache.lucene.codecs.KnnVectorsFormat with
-      Lucene92HnswVectorsFormat;
+      Lucene93HnswVectorsFormat;
   provides org.apache.lucene.codecs.PostingsFormat with
       org.apache.lucene.codecs.lucene90.Lucene90PostingsFormat;
   provides org.apache.lucene.index.SortFieldProvider with
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/Codec.java b/lucene/core/src/java/org/apache/lucene/codecs/Codec.java
index bb75a5bca40..7cae722711e 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/Codec.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/Codec.java
@@ -55,7 +55,7 @@ public abstract class Codec implements NamedSPILoader.NamedSPI {
       return LOADER;
     }
 
-    static Codec defaultCodec = LOADER.lookup("Lucene92");
+    static Codec defaultCodec = LOADER.lookup("Lucene93");
   }
 
   private final String name;
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java
index 3e1903874c5..945b213b034 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java
@@ -84,8 +84,7 @@ public abstract class KnnVectorsFormat implements NamedSPILoader.NamedSPI {
       new KnnVectorsFormat("EMPTY") {
         @Override
         public KnnVectorsWriter fieldsWriter(SegmentWriteState state) {
-          throw new UnsupportedOperationException(
-              "Attempt to write EMPTY VectorValues: maybe you forgot to use codec=Lucene92");
+          throw new UnsupportedOperationException("Attempt to write EMPTY VectorValues");
         }
 
         @Override
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92Codec.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93Codec.java
similarity index 92%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92Codec.java
rename to lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93Codec.java
index 5264295a902..b041c4ce1e9 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92Codec.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93Codec.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.codecs.lucene93;
 
 import java.util.Objects;
 import org.apache.lucene.codecs.Codec;
@@ -45,14 +45,14 @@ import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
 import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
 
 /**
- * Implements the Lucene 9.2 index format
+ * Implements the Lucene 9.3 index format
  *
  * <p>If you want to reuse functionality of this codec in another codec, extend {@link FilterCodec}.
  *
- * @see org.apache.lucene.codecs.lucene92 package documentation for file format details.
+ * @see org.apache.lucene.codecs.lucene93 package documentation for file format details.
  * @lucene.experimental
  */
-public class Lucene92Codec extends Codec {
+public class Lucene93Codec extends Codec {
 
   /** Configuration option for the codec. */
   public enum Mode {
@@ -80,7 +80,7 @@ public class Lucene92Codec extends Codec {
       new PerFieldPostingsFormat() {
         @Override
         public PostingsFormat getPostingsFormatForField(String field) {
-          return Lucene92Codec.this.getPostingsFormatForField(field);
+          return Lucene93Codec.this.getPostingsFormatForField(field);
         }
       };
 
@@ -89,7 +89,7 @@ public class Lucene92Codec extends Codec {
       new PerFieldDocValuesFormat() {
         @Override
         public DocValuesFormat getDocValuesFormatForField(String field) {
-          return Lucene92Codec.this.getDocValuesFormatForField(field);
+          return Lucene93Codec.this.getDocValuesFormatForField(field);
         }
       };
 
@@ -98,14 +98,14 @@ public class Lucene92Codec extends Codec {
       new PerFieldKnnVectorsFormat() {
         @Override
         public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
-          return Lucene92Codec.this.getKnnVectorsFormatForField(field);
+          return Lucene93Codec.this.getKnnVectorsFormatForField(field);
         }
       };
 
   private final StoredFieldsFormat storedFieldsFormat;
 
   /** Instantiates a new codec. */
-  public Lucene92Codec() {
+  public Lucene93Codec() {
     this(Mode.BEST_SPEED);
   }
 
@@ -114,13 +114,13 @@ public class Lucene92Codec extends Codec {
    *
    * @param mode stored fields compression mode to use for newly flushed/merged segments.
    */
-  public Lucene92Codec(Mode mode) {
-    super("Lucene92");
+  public Lucene93Codec(Mode mode) {
+    super("Lucene93");
     this.storedFieldsFormat =
         new Lucene90StoredFieldsFormat(Objects.requireNonNull(mode).storedMode);
     this.defaultPostingsFormat = new Lucene90PostingsFormat();
     this.defaultDVFormat = new Lucene90DocValuesFormat();
-    this.defaultKnnVectorsFormat = new Lucene92HnswVectorsFormat();
+    this.defaultKnnVectorsFormat = new Lucene93HnswVectorsFormat();
   }
 
   @Override
@@ -196,7 +196,7 @@ public class Lucene92Codec extends Codec {
   /**
    * Returns the vectors format that should be used for writing new segments of <code>field</code>
    *
-   * <p>The default implementation always returns "lucene92".
+   * <p>The default implementation always returns "lucene93".
    *
    * <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility:
    * future version of Lucene are only guaranteed to be able to read the default implementation.
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsFormat.java
similarity index 83%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsFormat.java
rename to lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsFormat.java
index 3b28b706890..e795920d254 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsFormat.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.codecs.lucene93;
 
 import java.io.IOException;
 import org.apache.lucene.codecs.KnnVectorsFormat;
@@ -29,7 +29,7 @@ import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.util.hnsw.HnswGraph;
 
 /**
- * Lucene 9.2 vector format, which encodes numeric vector values and an optional associated graph
+ * Lucene 9.3 vector format, which encodes numeric vector values and an optional associated graph
  * connecting the documents having values. The graph is used to power HNSW search. The format
  * consists of three files:
  *
@@ -95,11 +95,11 @@ import org.apache.lucene.util.hnsw.HnswGraph;
  *
  * @lucene.experimental
  */
-public final class Lucene92HnswVectorsFormat extends KnnVectorsFormat {
+public final class Lucene93HnswVectorsFormat extends KnnVectorsFormat {
 
-  static final String META_CODEC_NAME = "lucene92HnswVectorsFormatMeta";
-  static final String VECTOR_DATA_CODEC_NAME = "lucene92HnswVectorsFormatData";
-  static final String VECTOR_INDEX_CODEC_NAME = "lucene92HnswVectorsFormatIndex";
+  static final String META_CODEC_NAME = "lucene93HnswVectorsFormatMeta";
+  static final String VECTOR_DATA_CODEC_NAME = "lucene93HnswVectorsFormatData";
+  static final String VECTOR_INDEX_CODEC_NAME = "lucene93HnswVectorsFormatIndex";
   static final String META_EXTENSION = "vem";
   static final String VECTOR_DATA_EXTENSION = "vec";
   static final String VECTOR_INDEX_EXTENSION = "vex";
@@ -118,40 +118,47 @@ public final class Lucene92HnswVectorsFormat extends KnnVectorsFormat {
 
   /**
    * Controls how many of the nearest neighbor candidates are connected to the new node. Defaults to
-   * {@link Lucene92HnswVectorsFormat#DEFAULT_MAX_CONN}. See {@link HnswGraph} for more details.
+   * {@link Lucene93HnswVectorsFormat#DEFAULT_MAX_CONN}. See {@link HnswGraph} for more details.
    */
   private final int maxConn;
 
   /**
    * The number of candidate neighbors to track while searching the graph for each newly inserted
-   * node. Defaults to to {@link Lucene92HnswVectorsFormat#DEFAULT_BEAM_WIDTH}. See {@link
+   * node. Defaults to to {@link Lucene93HnswVectorsFormat#DEFAULT_BEAM_WIDTH}. See {@link
    * HnswGraph} for details.
    */
   private final int beamWidth;
 
-  public Lucene92HnswVectorsFormat() {
+  /** Constructs a format using default graph construction parameters */
+  public Lucene93HnswVectorsFormat() {
     this(DEFAULT_MAX_CONN, DEFAULT_BEAM_WIDTH);
   }
 
-  public Lucene92HnswVectorsFormat(int maxConn, int beamWidth) {
-    super("lucene92HnswVectorsFormat");
+  /**
+   * Constructs a format using the given graph construction parameters.
+   *
+   * @param maxConn the maximum number of connections to a node in the HNSW graph
+   * @param beamWidth the size of the queue maintained during graph construction.
+   */
+  public Lucene93HnswVectorsFormat(int maxConn, int beamWidth) {
+    super("lucene93HnswVectorsFormat");
     this.maxConn = maxConn;
     this.beamWidth = beamWidth;
   }
 
   @Override
   public KnnVectorsWriter fieldsWriter(SegmentWriteState state) throws IOException {
-    return new Lucene92HnswVectorsWriter(state, maxConn, beamWidth);
+    return new Lucene93HnswVectorsWriter(state, maxConn, beamWidth);
   }
 
   @Override
   public KnnVectorsReader fieldsReader(SegmentReadState state) throws IOException {
-    return new Lucene92HnswVectorsReader(state);
+    return new Lucene93HnswVectorsReader(state);
   }
 
   @Override
   public String toString() {
-    return "lucene92HnswVectorsFormat(name = lucene92HnswVectorsFormat, maxConn = "
+    return "lucene93HnswVectorsFormat(name = lucene93HnswVectorsFormat, maxConn = "
         + maxConn
         + ", beamWidth="
         + beamWidth
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsReader.java
similarity index 95%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsReader.java
rename to lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsReader.java
index 70ceab4c5be..e439b7a52f0 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsReader.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.codecs.lucene93;
 
 import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
 
@@ -51,14 +51,14 @@ import org.apache.lucene.util.packed.DirectMonotonicReader;
  *
  * @lucene.experimental
  */
-public final class Lucene92HnswVectorsReader extends KnnVectorsReader {
+public final class Lucene93HnswVectorsReader extends KnnVectorsReader {
 
   private final FieldInfos fieldInfos;
   private final Map<String, FieldEntry> fields = new HashMap<>();
   private final IndexInput vectorData;
   private final IndexInput vectorIndex;
 
-  Lucene92HnswVectorsReader(SegmentReadState state) throws IOException {
+  Lucene93HnswVectorsReader(SegmentReadState state) throws IOException {
     this.fieldInfos = state.fieldInfos;
     int versionMeta = readMetadata(state);
     boolean success = false;
@@ -67,14 +67,14 @@ public final class Lucene92HnswVectorsReader extends KnnVectorsReader {
           openDataInput(
               state,
               versionMeta,
-              Lucene92HnswVectorsFormat.VECTOR_DATA_EXTENSION,
-              Lucene92HnswVectorsFormat.VECTOR_DATA_CODEC_NAME);
+              Lucene93HnswVectorsFormat.VECTOR_DATA_EXTENSION,
+              Lucene93HnswVectorsFormat.VECTOR_DATA_CODEC_NAME);
       vectorIndex =
           openDataInput(
               state,
               versionMeta,
-              Lucene92HnswVectorsFormat.VECTOR_INDEX_EXTENSION,
-              Lucene92HnswVectorsFormat.VECTOR_INDEX_CODEC_NAME);
+              Lucene93HnswVectorsFormat.VECTOR_INDEX_EXTENSION,
+              Lucene93HnswVectorsFormat.VECTOR_INDEX_CODEC_NAME);
       success = true;
     } finally {
       if (success == false) {
@@ -86,7 +86,7 @@ public final class Lucene92HnswVectorsReader extends KnnVectorsReader {
   private int readMetadata(SegmentReadState state) throws IOException {
     String metaFileName =
         IndexFileNames.segmentFileName(
-            state.segmentInfo.name, state.segmentSuffix, Lucene92HnswVectorsFormat.META_EXTENSION);
+            state.segmentInfo.name, state.segmentSuffix, Lucene93HnswVectorsFormat.META_EXTENSION);
     int versionMeta = -1;
     try (ChecksumIndexInput meta = state.directory.openChecksumInput(metaFileName, state.context)) {
       Throwable priorE = null;
@@ -94,9 +94,9 @@ public final class Lucene92HnswVectorsReader extends KnnVectorsReader {
         versionMeta =
             CodecUtil.checkIndexHeader(
                 meta,
-                Lucene92HnswVectorsFormat.META_CODEC_NAME,
-                Lucene92HnswVectorsFormat.VERSION_START,
-                Lucene92HnswVectorsFormat.VERSION_CURRENT,
+                Lucene93HnswVectorsFormat.META_CODEC_NAME,
+                Lucene93HnswVectorsFormat.VERSION_START,
+                Lucene93HnswVectorsFormat.VERSION_CURRENT,
                 state.segmentInfo.getId(),
                 state.segmentSuffix);
         readFields(meta, state.fieldInfos);
@@ -121,8 +121,8 @@ public final class Lucene92HnswVectorsReader extends KnnVectorsReader {
           CodecUtil.checkIndexHeader(
               in,
               codecName,
-              Lucene92HnswVectorsFormat.VERSION_START,
-              Lucene92HnswVectorsFormat.VERSION_CURRENT,
+              Lucene93HnswVectorsFormat.VERSION_START,
+              Lucene93HnswVectorsFormat.VERSION_CURRENT,
               state.segmentInfo.getId(),
               state.segmentSuffix);
       if (versionMeta != versionVectorData) {
@@ -200,7 +200,7 @@ public final class Lucene92HnswVectorsReader extends KnnVectorsReader {
 
   @Override
   public long ramBytesUsed() {
-    long totalBytes = RamUsageEstimator.shallowSizeOfInstance(Lucene92HnswVectorsFormat.class);
+    long totalBytes = RamUsageEstimator.shallowSizeOfInstance(Lucene93HnswVectorsFormat.class);
     totalBytes +=
         RamUsageEstimator.sizeOfMap(
             fields, RamUsageEstimator.shallowSizeOfInstance(FieldEntry.class));
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsWriter.java
similarity index 93%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsWriter.java
rename to lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsWriter.java
index e63ab2ce277..b1b9823b612 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/Lucene92HnswVectorsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsWriter.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.codecs.lucene93;
 
-import static org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat.DIRECT_MONOTONIC_BLOCK_SHIFT;
+import static org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat.DIRECT_MONOTONIC_BLOCK_SHIFT;
 import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
 
 import java.io.IOException;
@@ -49,7 +49,7 @@ import org.apache.lucene.util.packed.DirectMonotonicWriter;
  *
  * @lucene.experimental
  */
-public final class Lucene92HnswVectorsWriter extends KnnVectorsWriter {
+public final class Lucene93HnswVectorsWriter extends KnnVectorsWriter {
 
   private final SegmentWriteState segmentWriteState;
   private final IndexOutput meta, vectorData, vectorIndex;
@@ -59,7 +59,7 @@ public final class Lucene92HnswVectorsWriter extends KnnVectorsWriter {
   private final int beamWidth;
   private boolean finished;
 
-  Lucene92HnswVectorsWriter(SegmentWriteState state, int M, int beamWidth) throws IOException {
+  Lucene93HnswVectorsWriter(SegmentWriteState state, int M, int beamWidth) throws IOException {
     this.M = M;
     this.beamWidth = beamWidth;
 
@@ -68,19 +68,19 @@ public final class Lucene92HnswVectorsWriter extends KnnVectorsWriter {
 
     String metaFileName =
         IndexFileNames.segmentFileName(
-            state.segmentInfo.name, state.segmentSuffix, Lucene92HnswVectorsFormat.META_EXTENSION);
+            state.segmentInfo.name, state.segmentSuffix, Lucene93HnswVectorsFormat.META_EXTENSION);
 
     String vectorDataFileName =
         IndexFileNames.segmentFileName(
             state.segmentInfo.name,
             state.segmentSuffix,
-            Lucene92HnswVectorsFormat.VECTOR_DATA_EXTENSION);
+            Lucene93HnswVectorsFormat.VECTOR_DATA_EXTENSION);
 
     String indexDataFileName =
         IndexFileNames.segmentFileName(
             state.segmentInfo.name,
             state.segmentSuffix,
-            Lucene92HnswVectorsFormat.VECTOR_INDEX_EXTENSION);
+            Lucene93HnswVectorsFormat.VECTOR_INDEX_EXTENSION);
 
     boolean success = false;
     try {
@@ -90,20 +90,20 @@ public final class Lucene92HnswVectorsWriter extends KnnVectorsWriter {
 
       CodecUtil.writeIndexHeader(
           meta,
-          Lucene92HnswVectorsFormat.META_CODEC_NAME,
-          Lucene92HnswVectorsFormat.VERSION_CURRENT,
+          Lucene93HnswVectorsFormat.META_CODEC_NAME,
+          Lucene93HnswVectorsFormat.VERSION_CURRENT,
           state.segmentInfo.getId(),
           state.segmentSuffix);
       CodecUtil.writeIndexHeader(
           vectorData,
-          Lucene92HnswVectorsFormat.VECTOR_DATA_CODEC_NAME,
-          Lucene92HnswVectorsFormat.VERSION_CURRENT,
+          Lucene93HnswVectorsFormat.VECTOR_DATA_CODEC_NAME,
+          Lucene93HnswVectorsFormat.VERSION_CURRENT,
           state.segmentInfo.getId(),
           state.segmentSuffix);
       CodecUtil.writeIndexHeader(
           vectorIndex,
-          Lucene92HnswVectorsFormat.VECTOR_INDEX_CODEC_NAME,
-          Lucene92HnswVectorsFormat.VERSION_CURRENT,
+          Lucene93HnswVectorsFormat.VECTOR_INDEX_CODEC_NAME,
+          Lucene93HnswVectorsFormat.VERSION_CURRENT,
           state.segmentInfo.getId(),
           state.segmentSuffix);
       maxDoc = state.segmentInfo.maxDoc();
@@ -142,7 +142,7 @@ public final class Lucene92HnswVectorsWriter extends KnnVectorsWriter {
 
       long vectorIndexOffset = vectorIndex.getFilePointer();
       // build the graph using the temporary vector data
-      // we use Lucene92HnswVectorsReader.DenseOffHeapVectorValues for the graph construction
+      // we use Lucene93HnswVectorsReader.DenseOffHeapVectorValues for the graph construction
       // doesn't need to know docIds
       // TODO: separate random access vector values from DocIdSetIterator?
       OffHeapVectorValues offHeapVectors =
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/OffHeapVectorValues.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/OffHeapVectorValues.java
similarity index 97%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene92/OffHeapVectorValues.java
rename to lucene/core/src/java/org/apache/lucene/codecs/lucene93/OffHeapVectorValues.java
index 199df605fe0..c7e751370b4 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/OffHeapVectorValues.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/OffHeapVectorValues.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.codecs.lucene93;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -87,7 +87,7 @@ abstract class OffHeapVectorValues extends VectorValues
   public abstract int ordToDoc(int ord);
 
   static OffHeapVectorValues load(
-      Lucene92HnswVectorsReader.FieldEntry fieldEntry, IndexInput vectorData) throws IOException {
+      Lucene93HnswVectorsReader.FieldEntry fieldEntry, IndexInput vectorData) throws IOException {
     if (fieldEntry.docsWithFieldOffset == -2) {
       return new EmptyOffHeapVectorValues(fieldEntry.dimension);
     }
@@ -164,10 +164,10 @@ abstract class OffHeapVectorValues extends VectorValues
     private final IndexedDISI disi;
     // dataIn was used to init a new IndexedDIS for #randomAccess()
     private final IndexInput dataIn;
-    private final Lucene92HnswVectorsReader.FieldEntry fieldEntry;
+    private final Lucene93HnswVectorsReader.FieldEntry fieldEntry;
 
     public SparseOffHeapVectorValues(
-        Lucene92HnswVectorsReader.FieldEntry fieldEntry, IndexInput dataIn, IndexInput slice)
+        Lucene93HnswVectorsReader.FieldEntry fieldEntry, IndexInput dataIn, IndexInput slice)
         throws IOException {
 
       super(fieldEntry.dimension, fieldEntry.size, slice);
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/package-info.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/package-info.java
similarity index 99%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene92/package-info.java
rename to lucene/core/src/java/org/apache/lucene/codecs/lucene93/package-info.java
index f87fd0f2995..1c01c23ea0c 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene92/package-info.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/package-info.java
@@ -16,7 +16,7 @@
  */
 
 /**
- * Lucene 9.2 file format.
+ * Lucene 9.3 file format.
  *
  * <h2>Apache Lucene - Index File Formats</h2>
  *
@@ -180,7 +180,7 @@
  *       of files, recording dimensionally indexed fields, to enable fast numeric range filtering
  *       and large numeric values like BigInteger and BigDecimal (1D) and geographic shape
  *       intersection (2D, 3D).
- *   <li>{@link org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat Vector values}. The
+ *   <li>{@link org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat Vector values}. The
  *       vector format stores numeric vectors in a format optimized for random access and
  *       computation, supporting high-dimensional nearest-neighbor search.
  * </ul>
@@ -310,7 +310,7 @@
  * <td>Holds indexed points</td>
  * </tr>
  * <tr>
- * <td>{@link org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat Vector values}</td>
+ * <td>{@link org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat Vector values}</td>
  * <td>.vec, .vem</td>
  * <td>Holds indexed vectors; <code>.vec</code> files contain the raw vector data, and
  * <code>.vem</code> the vector metadata</td>
@@ -419,4 +419,4 @@
  * <code>UInt64</code> values, or better yet, {@link org.apache.lucene.store.DataOutput#writeVInt
  * VInt} values which have no limit. </div>
  */
-package org.apache.lucene.codecs.lucene92;
+package org.apache.lucene.codecs.lucene93;
diff --git a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec
index cd3ccaa8e17..57d114906fa 100644
--- a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec
+++ b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec
@@ -13,4 +13,4 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-org.apache.lucene.codecs.lucene92.Lucene92Codec
+org.apache.lucene.codecs.lucene93.Lucene93Codec
diff --git a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat
index 35bd0c0824a..c20b1176abc 100644
--- a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat
+++ b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat
@@ -13,4 +13,4 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat
+org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90StoredFieldsFormatHighCompression.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90StoredFieldsFormatHighCompression.java
index fe6c43e2893..f36820ef1a6 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90StoredFieldsFormatHighCompression.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90StoredFieldsFormatHighCompression.java
@@ -18,8 +18,8 @@ package org.apache.lucene.codecs.lucene90;
 
 import com.carrotsearch.randomizedtesting.generators.RandomPicks;
 import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec.Mode;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec.Mode;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.StoredField;
 import org.apache.lucene.index.DirectoryReader;
@@ -31,7 +31,7 @@ import org.apache.lucene.tests.index.BaseStoredFieldsFormatTestCase;
 public class TestLucene90StoredFieldsFormatHighCompression extends BaseStoredFieldsFormatTestCase {
   @Override
   protected Codec getCodec() {
-    return new Lucene92Codec(Mode.BEST_COMPRESSION);
+    return new Lucene93Codec(Mode.BEST_COMPRESSION);
   }
 
   /**
@@ -41,7 +41,7 @@ public class TestLucene90StoredFieldsFormatHighCompression extends BaseStoredFie
     Directory dir = newDirectory();
     for (int i = 0; i < 10; i++) {
       IndexWriterConfig iwc = newIndexWriterConfig();
-      iwc.setCodec(new Lucene92Codec(RandomPicks.randomFrom(random(), Mode.values())));
+      iwc.setCodec(new Lucene93Codec(RandomPicks.randomFrom(random(), Mode.values())));
       IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig());
       Document doc = new Document();
       doc.add(new StoredField("field1", "value1"));
@@ -70,7 +70,7 @@ public class TestLucene90StoredFieldsFormatHighCompression extends BaseStoredFie
     expectThrows(
         NullPointerException.class,
         () -> {
-          new Lucene92Codec(null);
+          new Lucene93Codec(null);
         });
 
     expectThrows(
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestKnnGraph.java b/lucene/core/src/test/org/apache/lucene/index/TestKnnGraph.java
index 3a54c407070..fa3885db5c5 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestKnnGraph.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestKnnGraph.java
@@ -30,9 +30,9 @@ import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.codecs.KnnVectorsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsReader;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsReader;
 import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -64,7 +64,7 @@ public class TestKnnGraph extends LuceneTestCase {
 
   private static final String KNN_GRAPH_FIELD = "vector";
 
-  private static int M = Lucene92HnswVectorsFormat.DEFAULT_MAX_CONN;
+  private static int M = Lucene93HnswVectorsFormat.DEFAULT_MAX_CONN;
 
   private Codec codec;
   private VectorSimilarityFunction similarityFunction;
@@ -77,10 +77,10 @@ public class TestKnnGraph extends LuceneTestCase {
     }
 
     codec =
-        new Lucene92Codec() {
+        new Lucene93Codec() {
           @Override
           public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
-            return new Lucene92HnswVectorsFormat(M, Lucene92HnswVectorsFormat.DEFAULT_BEAM_WIDTH);
+            return new Lucene93HnswVectorsFormat(M, Lucene93HnswVectorsFormat.DEFAULT_BEAM_WIDTH);
           }
         };
 
@@ -90,7 +90,7 @@ public class TestKnnGraph extends LuceneTestCase {
 
   @After
   public void cleanup() {
-    M = Lucene92HnswVectorsFormat.DEFAULT_MAX_CONN;
+    M = Lucene93HnswVectorsFormat.DEFAULT_MAX_CONN;
   }
 
   /** Basic test of creating documents in a graph */
@@ -237,8 +237,8 @@ public class TestKnnGraph extends LuceneTestCase {
         PerFieldKnnVectorsFormat.FieldsReader perFieldReader =
             (PerFieldKnnVectorsFormat.FieldsReader)
                 ((CodecReader) getOnlyLeafReader(reader)).getVectorReader();
-        Lucene92HnswVectorsReader vectorReader =
-            (Lucene92HnswVectorsReader) perFieldReader.getFieldReader(KNN_GRAPH_FIELD);
+        Lucene93HnswVectorsReader vectorReader =
+            (Lucene93HnswVectorsReader) perFieldReader.getFieldReader(KNN_GRAPH_FIELD);
         graph = copyGraph(vectorReader.getGraph(KNN_GRAPH_FIELD));
       }
     }
@@ -436,8 +436,8 @@ public class TestKnnGraph extends LuceneTestCase {
         if (perFieldReader == null) {
           continue;
         }
-        Lucene92HnswVectorsReader vectorReader =
-            (Lucene92HnswVectorsReader) perFieldReader.getFieldReader(vectorField);
+        Lucene93HnswVectorsReader vectorReader =
+            (Lucene93HnswVectorsReader) perFieldReader.getFieldReader(vectorField);
         if (vectorReader == null) {
           continue;
         }
diff --git a/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java b/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java
index cda580d7ff1..bb659f0bded 100644
--- a/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java
+++ b/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java
@@ -37,9 +37,9 @@ import java.util.Locale;
 import java.util.Set;
 import org.apache.lucene.codecs.KnnVectorsFormat;
 import org.apache.lucene.codecs.KnnVectorsReader;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsReader;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsReader;
 import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.FieldType;
@@ -251,7 +251,7 @@ public class KnnGraphTester {
         KnnVectorsReader vectorsReader =
             ((PerFieldKnnVectorsFormat.FieldsReader) ((CodecReader) leafReader).getVectorReader())
                 .getFieldReader(KNN_FIELD);
-        HnswGraph knnValues = ((Lucene92HnswVectorsReader) vectorsReader).getGraph(KNN_FIELD);
+        HnswGraph knnValues = ((Lucene93HnswVectorsReader) vectorsReader).getGraph(KNN_FIELD);
         System.out.printf("Leaf %d has %d documents\n", context.ord, leafReader.maxDoc());
         printGraphFanout(knnValues, leafReader.maxDoc());
       }
@@ -580,10 +580,10 @@ public class KnnGraphTester {
   private int createIndex(Path docsPath, Path indexPath) throws IOException {
     IndexWriterConfig iwc = new IndexWriterConfig().setOpenMode(IndexWriterConfig.OpenMode.CREATE);
     iwc.setCodec(
-        new Lucene92Codec() {
+        new Lucene93Codec() {
           @Override
           public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
-            return new Lucene92HnswVectorsFormat(maxConn, beamWidth);
+            return new Lucene93HnswVectorsFormat(maxConn, beamWidth);
           }
         });
     // iwc.setMergePolicy(NoMergePolicy.INSTANCE);
diff --git a/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java b/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
index ed1b31d9861..8e357b91898 100644
--- a/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
+++ b/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
@@ -25,9 +25,9 @@ import java.util.HashSet;
 import java.util.Random;
 import java.util.Set;
 import org.apache.lucene.codecs.KnnVectorsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsReader;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsReader;
 import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.KnnVectorField;
@@ -81,10 +81,10 @@ public class TestHnswGraph extends LuceneTestCase {
       IndexWriterConfig iwc =
           new IndexWriterConfig()
               .setCodec(
-                  new Lucene92Codec() {
+                  new Lucene93Codec() {
                     @Override
                     public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
-                      return new Lucene92HnswVectorsFormat(M, beamWidth);
+                      return new Lucene93HnswVectorsFormat(M, beamWidth);
                     }
                   });
       try (IndexWriter iw = new IndexWriter(dir, iwc)) {
@@ -111,7 +111,7 @@ public class TestHnswGraph extends LuceneTestCase {
           assertEquals(indexedDoc, ctx.reader().numDocs());
           assertVectorsEqual(v3, values);
           HnswGraph graphValues =
-              ((Lucene92HnswVectorsReader)
+              ((Lucene93HnswVectorsReader)
                       ((PerFieldKnnVectorsFormat.FieldsReader)
                               ((CodecReader) ctx.reader()).getVectorReader())
                           .getFieldReader("field"))
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
index b57c87d8c0a..dd8c6db42c2 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
@@ -40,7 +40,7 @@ import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
 import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.codecs.PostingsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.IntPoint;
@@ -959,7 +959,7 @@ public class TestSuggestField extends LuceneTestCase {
     IndexWriterConfig iwc = newIndexWriterConfig(random(), analyzer);
     iwc.setMergePolicy(newLogMergePolicy());
     Codec filterCodec =
-        new Lucene92Codec() {
+        new Lucene93Codec() {
           CompletionPostingsFormat.FSTLoadMode fstLoadMode =
               RandomPicks.randomFrom(random(), CompletionPostingsFormat.FSTLoadMode.values());
           PostingsFormat postingsFormat = new Completion90PostingsFormat(fstLoadMode);
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestRuleSetupAndRestoreClassEnv.java b/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestRuleSetupAndRestoreClassEnv.java
index 8392640558a..ec612479ea1 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestRuleSetupAndRestoreClassEnv.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestRuleSetupAndRestoreClassEnv.java
@@ -38,7 +38,7 @@ import java.util.TimeZone;
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.codecs.DocValuesFormat;
 import org.apache.lucene.codecs.PostingsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
 import org.apache.lucene.codecs.simpletext.SimpleTextCodec;
 import org.apache.lucene.search.similarities.Similarity;
 import org.apache.lucene.tests.codecs.asserting.AssertingCodec;
@@ -193,9 +193,9 @@ final class TestRuleSetupAndRestoreClassEnv extends AbstractBeforeAfterRule {
     } else if ("Compressing".equals(TEST_CODEC)
         || ("random".equals(TEST_CODEC) && randomVal == 6 && !shouldAvoidCodec("Compressing"))) {
       codec = CompressingCodec.randomInstance(random);
-    } else if ("Lucene92".equals(TEST_CODEC)
-        || ("random".equals(TEST_CODEC) && randomVal == 5 && !shouldAvoidCodec("Lucene92"))) {
-      codec = new Lucene92Codec(RandomPicks.randomFrom(random, Lucene92Codec.Mode.values()));
+    } else if ("Lucene93".equals(TEST_CODEC)
+        || ("random".equals(TEST_CODEC) && randomVal == 5 && !shouldAvoidCodec("Lucene93"))) {
+      codec = new Lucene93Codec(RandomPicks.randomFrom(random, Lucene93Codec.Mode.values()));
     } else if (!"random".equals(TEST_CODEC)) {
       codec = Codec.forName(TEST_CODEC);
     } else if ("random".equals(TEST_POSTINGSFORMAT)) {
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestUtil.java
index e6722972ac2..f4d871f682d 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestUtil.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/util/TestUtil.java
@@ -55,8 +55,8 @@ import org.apache.lucene.codecs.PostingsFormat;
 import org.apache.lucene.codecs.blocktreeords.BlockTreeOrdsPostingsFormat;
 import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
 import org.apache.lucene.codecs.lucene90.Lucene90PostingsFormat;
-import org.apache.lucene.codecs.lucene92.Lucene92Codec;
-import org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsFormat;
+import org.apache.lucene.codecs.lucene93.Lucene93Codec;
+import org.apache.lucene.codecs.lucene93.Lucene93HnswVectorsFormat;
 import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;
 import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
 import org.apache.lucene.document.BinaryDocValuesField;
@@ -1236,7 +1236,7 @@ public final class TestUtil {
    * different than {@link Codec#getDefault()} because that is randomized.
    */
   public static Codec getDefaultCodec() {
-    return new Lucene92Codec();
+    return new Lucene93Codec();
   }
 
   /**
@@ -1322,7 +1322,7 @@ public final class TestUtil {
    * Lucene.
    */
   public static KnnVectorsFormat getDefaultKnnVectorsFormat() {
-    return new Lucene92HnswVectorsFormat();
+    return new Lucene93HnswVectorsFormat();
   }
 
   public static boolean anyFilesExceptWriteLock(Directory dir) throws IOException {


[lucene] 02/02: LUCENE-10593: VectorSimilarityFunction reverse removal (#926)

Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

abenedetti pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit b3b7098cd9636c5ad2516055f768dd29b795a05d
Author: Alessandro Benedetti <a....@sease.io>
AuthorDate: Tue Jun 28 15:33:11 2022 +0200

    LUCENE-10593: VectorSimilarityFunction reverse removal (#926)
    
    * Vector Similarity Function reverse property removed
    
    * NeighborQueue tie-breaking fixed (node id + node score encoding)
    
    * NeighborQueue readability refactor
    
    * BoundChecker removal (now it's only in backward-codecs)
---
 lucene/CHANGES.txt                                 |  2 +
 .../lucene90/Lucene90BoundsChecker.java}           | 27 ++++++++---
 .../lucene90/Lucene90HnswGraphBuilder.java         | 20 ++++----
 .../lucene90/Lucene90HnswVectorsReader.java        |  4 +-
 .../lucene90/Lucene90OnHeapHnswGraph.java          | 19 ++++----
 .../lucene91/Lucene91BoundsChecker.java}           | 27 ++++++++---
 .../lucene91/Lucene91HnswGraphBuilder.java         | 25 +++++-----
 .../lucene91/Lucene91HnswVectorsReader.java        |  4 +-
 .../lucene92/Lucene92HnswVectorsReader.java        |  4 +-
 .../simpletext/SimpleTextKnnVectorsReader.java     |  2 +-
 .../codecs/lucene93/Lucene93HnswVectorsReader.java |  2 +-
 .../lucene/index/VectorSimilarityFunction.java     | 52 +++------------------
 .../org/apache/lucene/search/KnnVectorQuery.java   |  2 +-
 .../apache/lucene/util/hnsw/HnswGraphBuilder.java  | 24 +++++-----
 .../apache/lucene/util/hnsw/HnswGraphSearcher.java | 22 ++++-----
 .../org/apache/lucene/util/hnsw/NeighborQueue.java | 54 ++++++++++++++++++----
 .../apache/lucene/util/hnsw/OnHeapHnswGraph.java   | 10 ++--
 .../apache/lucene/util/hnsw/KnnGraphTester.java    |  5 +-
 .../org/apache/lucene/util/hnsw/TestHnswGraph.java | 26 +----------
 19 files changed, 161 insertions(+), 170 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 41fad11b781..7c0c35e6c6d 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -103,6 +103,8 @@ Optimizations
 
 * LUCENE-10606: For KnnVectorQuery, optimize case where filter is backed by BitSetIterator (Kaival Parikh)
 
+* LUCENE-10593: Vector similarity function and NeighborQueue reverse removal. (Alessandro Benedetti)
+
 Bug Fixes
 ---------------------
 
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90BoundsChecker.java
similarity index 77%
copy from lucene/core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java
copy to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90BoundsChecker.java
index 9cde17db421..e181dc0ec57 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90BoundsChecker.java
@@ -14,17 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-package org.apache.lucene.util.hnsw;
+package org.apache.lucene.backward_codecs.lucene90;
 
 /**
  * A helper class for an hnsw graph that serves as a comparator of the currently set bound value
  * with a new value.
  */
-public abstract class BoundsChecker {
+public abstract class Lucene90BoundsChecker {
 
   float bound;
 
+  /** Default Constructor */
+  public Lucene90BoundsChecker() {}
+
   /** Update the bound if sample is better */
   public abstract void update(float sample);
 
@@ -33,10 +35,21 @@ public abstract class BoundsChecker {
     bound = sample;
   }
 
-  /** @return whether the sample exceeds (is worse than) the bound */
+  /**
+   * Check the sample
+   *
+   * @param sample a score
+   * @return whether the sample exceeds (is worse than) the bound
+   */
   public abstract boolean check(float sample);
 
-  public static BoundsChecker create(boolean reversed) {
+  /**
+   * Create a min or max bound checker
+   *
+   * @param reversed true for the min and false for the max
+   * @return the bound checker
+   */
+  public static Lucene90BoundsChecker create(boolean reversed) {
     if (reversed) {
       return new Min();
     } else {
@@ -48,7 +61,7 @@ public abstract class BoundsChecker {
    * A helper class for an hnsw graph that serves as a comparator of the currently set maximum value
    * with a new value.
    */
-  public static class Max extends BoundsChecker {
+  public static class Max extends Lucene90BoundsChecker {
     Max() {
       bound = Float.NEGATIVE_INFINITY;
     }
@@ -70,7 +83,7 @@ public abstract class BoundsChecker {
    * A helper class for an hnsw graph that serves as a comparator of the currently set minimum value
    * with a new value.
    */
-  public static class Min extends BoundsChecker {
+  public static class Min extends Lucene90BoundsChecker {
 
     Min() {
       bound = Float.POSITIVE_INFINITY;
diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswGraphBuilder.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswGraphBuilder.java
index bf07cd44f8c..d4c09455c7a 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswGraphBuilder.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswGraphBuilder.java
@@ -25,7 +25,6 @@ import org.apache.lucene.index.RandomAccessVectorValues;
 import org.apache.lucene.index.RandomAccessVectorValuesProducer;
 import org.apache.lucene.index.VectorSimilarityFunction;
 import org.apache.lucene.util.InfoStream;
-import org.apache.lucene.util.hnsw.BoundsChecker;
 import org.apache.lucene.util.hnsw.NeighborQueue;
 
 /**
@@ -51,7 +50,7 @@ public final class Lucene90HnswGraphBuilder {
   private final VectorSimilarityFunction similarityFunction;
   private final RandomAccessVectorValues vectorValues;
   private final SplittableRandom random;
-  private final BoundsChecker bound;
+  private final Lucene90BoundsChecker bound;
   final Lucene90OnHeapHnswGraph hnsw;
 
   private InfoStream infoStream = InfoStream.getDefault();
@@ -91,7 +90,7 @@ public final class Lucene90HnswGraphBuilder {
     this.maxConn = maxConn;
     this.beamWidth = beamWidth;
     this.hnsw = new Lucene90OnHeapHnswGraph(maxConn);
-    bound = BoundsChecker.create(similarityFunction.reversed);
+    bound = Lucene90BoundsChecker.create(false);
     random = new SplittableRandom(seed);
     scratch = new Lucene90NeighborArray(Math.max(beamWidth, maxConn + 1));
   }
@@ -234,9 +233,9 @@ public final class Lucene90HnswGraphBuilder {
       throws IOException {
     bound.set(score);
     for (int i = 0; i < neighbors.size(); i++) {
-      float diversityCheck =
+      float neighborSimilarity =
           similarityFunction.compare(candidate, vectorValues.vectorValue(neighbors.node()[i]));
-      if (bound.check(diversityCheck) == false) {
+      if (bound.check(neighborSimilarity) == false) {
         return false;
       }
     }
@@ -267,13 +266,14 @@ public final class Lucene90HnswGraphBuilder {
     for (int i = neighbors.size() - 1; i >= 0; i--) {
       // check each neighbor against its better-scoring neighbors. If it fails diversity check with
       // them, drop it
-      int nbrNode = neighbors.node()[i];
+      int neighborId = neighbors.node()[i];
       bound.set(neighbors.score()[i]);
-      float[] nbrVector = vectorValues.vectorValue(nbrNode);
+      float[] neighborVector = vectorValues.vectorValue(neighborId);
       for (int j = maxConn; j > i; j--) {
-        float diversityCheck =
-            similarityFunction.compare(nbrVector, buildVectors.vectorValue(neighbors.node()[j]));
-        if (bound.check(diversityCheck) == false) {
+        float neighborSimilarity =
+            similarityFunction.compare(
+                neighborVector, buildVectors.vectorValue(neighbors.node()[j]));
+        if (bound.check(neighborSimilarity) == false) {
           // node j is too similar to node i given its score relative to the base node
           // replace it with the new node, which is at [maxConn]
           return i;
diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswVectorsReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswVectorsReader.java
index 531140478c6..db3377bbde0 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswVectorsReader.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswVectorsReader.java
@@ -266,9 +266,9 @@ public final class Lucene90HnswVectorsReader extends KnnVectorsReader {
     ScoreDoc[] scoreDocs = new ScoreDoc[Math.min(results.size(), k)];
     while (results.size() > 0) {
       int node = results.topNode();
-      float score = fieldEntry.similarityFunction.convertToScore(results.topScore());
+      float minSimilarity = results.topScore();
       results.pop();
-      scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(fieldEntry.ordToDoc[node], score);
+      scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(fieldEntry.ordToDoc[node], minSimilarity);
     }
     TotalHits.Relation relation =
         results.incomplete()
diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90OnHeapHnswGraph.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90OnHeapHnswGraph.java
index 6457b8071e9..aeffedcc287 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90OnHeapHnswGraph.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90OnHeapHnswGraph.java
@@ -27,7 +27,6 @@ import org.apache.lucene.index.RandomAccessVectorValues;
 import org.apache.lucene.index.VectorSimilarityFunction;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.SparseFixedBitSet;
-import org.apache.lucene.util.hnsw.BoundsChecker;
 import org.apache.lucene.util.hnsw.HnswGraph;
 import org.apache.lucene.util.hnsw.NeighborQueue;
 
@@ -85,9 +84,9 @@ public final class Lucene90OnHeapHnswGraph extends HnswGraph {
     int size = graphValues.size();
 
     // MIN heap, holding the top results
-    NeighborQueue results = new NeighborQueue(numSeed, similarityFunction.reversed);
+    NeighborQueue results = new NeighborQueue(numSeed, false);
     // MAX heap, from which to pull the candidate nodes
-    NeighborQueue candidates = new NeighborQueue(numSeed, !similarityFunction.reversed);
+    NeighborQueue candidates = new NeighborQueue(numSeed, true);
 
     int numVisited = 0;
     // set of ordinals that have been visited by search on this layer, used to avoid backtracking
@@ -114,13 +113,13 @@ public final class Lucene90OnHeapHnswGraph extends HnswGraph {
     // Set the bound to the worst current result and below reject any newly-generated candidates
     // failing
     // to exceed this bound
-    BoundsChecker bound = BoundsChecker.create(similarityFunction.reversed);
+    Lucene90BoundsChecker bound = Lucene90BoundsChecker.create(false);
     bound.set(results.topScore());
     while (candidates.size() > 0 && results.incomplete() == false) {
       // get the best candidate (closest or best scoring)
-      float topCandidateScore = candidates.topScore();
+      float topCandidateSimilarity = candidates.topScore();
       if (results.size() >= topK) {
-        if (bound.check(topCandidateScore)) {
+        if (bound.check(topCandidateSimilarity)) {
           break;
         }
       }
@@ -138,11 +137,11 @@ public final class Lucene90OnHeapHnswGraph extends HnswGraph {
           break;
         }
 
-        float score = similarityFunction.compare(query, vectors.vectorValue(friendOrd));
-        if (results.size() < numSeed || bound.check(score) == false) {
-          candidates.add(friendOrd, score);
+        float friendSimilarity = similarityFunction.compare(query, vectors.vectorValue(friendOrd));
+        if (results.size() < numSeed || bound.check(friendSimilarity) == false) {
+          candidates.add(friendOrd, friendSimilarity);
           if (acceptOrds == null || acceptOrds.get(friendOrd)) {
-            results.insertWithOverflow(friendOrd, score);
+            results.insertWithOverflow(friendOrd, friendSimilarity);
             bound.set(results.topScore());
           }
         }
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91BoundsChecker.java
similarity index 77%
rename from lucene/core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java
rename to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91BoundsChecker.java
index 9cde17db421..eb854f69eb3 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/BoundsChecker.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91BoundsChecker.java
@@ -14,17 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-package org.apache.lucene.util.hnsw;
+package org.apache.lucene.backward_codecs.lucene91;
 
 /**
  * A helper class for an hnsw graph that serves as a comparator of the currently set bound value
  * with a new value.
  */
-public abstract class BoundsChecker {
+public abstract class Lucene91BoundsChecker {
 
   float bound;
 
+  /** Default Constructor */
+  public Lucene91BoundsChecker() {}
+
   /** Update the bound if sample is better */
   public abstract void update(float sample);
 
@@ -33,10 +35,21 @@ public abstract class BoundsChecker {
     bound = sample;
   }
 
-  /** @return whether the sample exceeds (is worse than) the bound */
+  /**
+   * Check the sample
+   *
+   * @param sample a score
+   * @return whether the sample exceeds (is worse than) the bound
+   */
   public abstract boolean check(float sample);
 
-  public static BoundsChecker create(boolean reversed) {
+  /**
+   * Create a min or max bound checker
+   *
+   * @param reversed true for the min and false for the max
+   * @return the bound checker
+   */
+  public static Lucene91BoundsChecker create(boolean reversed) {
     if (reversed) {
       return new Min();
     } else {
@@ -48,7 +61,7 @@ public abstract class BoundsChecker {
    * A helper class for an hnsw graph that serves as a comparator of the currently set maximum value
    * with a new value.
    */
-  public static class Max extends BoundsChecker {
+  public static class Max extends Lucene91BoundsChecker {
     Max() {
       bound = Float.NEGATIVE_INFINITY;
     }
@@ -70,7 +83,7 @@ public abstract class BoundsChecker {
    * A helper class for an hnsw graph that serves as a comparator of the currently set minimum value
    * with a new value.
    */
-  public static class Min extends BoundsChecker {
+  public static class Min extends Lucene91BoundsChecker {
 
     Min() {
       bound = Float.POSITIVE_INFINITY;
diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswGraphBuilder.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswGraphBuilder.java
index 002497d2d2a..54ff3240b32 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswGraphBuilder.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswGraphBuilder.java
@@ -28,7 +28,6 @@ import org.apache.lucene.index.RandomAccessVectorValuesProducer;
 import org.apache.lucene.index.VectorSimilarityFunction;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.InfoStream;
-import org.apache.lucene.util.hnsw.BoundsChecker;
 import org.apache.lucene.util.hnsw.HnswGraph;
 import org.apache.lucene.util.hnsw.HnswGraphSearcher;
 import org.apache.lucene.util.hnsw.NeighborQueue;
@@ -55,7 +54,7 @@ public final class Lucene91HnswGraphBuilder {
   private final VectorSimilarityFunction similarityFunction;
   private final RandomAccessVectorValues vectorValues;
   private final SplittableRandom random;
-  private final BoundsChecker bound;
+  private final Lucene91BoundsChecker bound;
   private final HnswGraphSearcher graphSearcher;
 
   final Lucene91OnHeapHnswGraph hnsw;
@@ -104,9 +103,9 @@ public final class Lucene91HnswGraphBuilder {
     this.graphSearcher =
         new HnswGraphSearcher(
             similarityFunction,
-            new NeighborQueue(beamWidth, similarityFunction.reversed == false),
+            new NeighborQueue(beamWidth, true),
             new FixedBitSet(vectorValues.size()));
-    bound = BoundsChecker.create(similarityFunction.reversed);
+    bound = Lucene91BoundsChecker.create(false);
     scratch = new Lucene91NeighborArray(Math.max(beamWidth, maxConn + 1));
   }
 
@@ -231,8 +230,8 @@ public final class Lucene91HnswGraphBuilder {
     // extract all the Neighbors from the queue into an array; these will now be
     // sorted from worst to best
     for (int i = 0; i < candidateCount; i++) {
-      float score = candidates.topScore();
-      scratch.add(candidates.pop(), score);
+      float similarity = candidates.topScore();
+      scratch.add(candidates.pop(), similarity);
     }
   }
 
@@ -253,9 +252,9 @@ public final class Lucene91HnswGraphBuilder {
       throws IOException {
     bound.set(score);
     for (int i = 0; i < neighbors.size(); i++) {
-      float diversityCheck =
+      float neighborSimilarity =
           similarityFunction.compare(candidate, vectorValues.vectorValue(neighbors.node[i]));
-      if (bound.check(diversityCheck) == false) {
+      if (bound.check(neighborSimilarity) == false) {
         return false;
       }
     }
@@ -286,13 +285,13 @@ public final class Lucene91HnswGraphBuilder {
     for (int i = neighbors.size() - 1; i >= 0; i--) {
       // check each neighbor against its better-scoring neighbors. If it fails diversity check with
       // them, drop it
-      int nbrNode = neighbors.node[i];
+      int neighborId = neighbors.node[i];
       bound.set(neighbors.score[i]);
-      float[] nbrVector = vectorValues.vectorValue(nbrNode);
+      float[] neighborVector = vectorValues.vectorValue(neighborId);
       for (int j = maxConn; j > i; j--) {
-        float diversityCheck =
-            similarityFunction.compare(nbrVector, buildVectors.vectorValue(neighbors.node[j]));
-        if (bound.check(diversityCheck) == false) {
+        float neighborSimilarity =
+            similarityFunction.compare(neighborVector, buildVectors.vectorValue(neighbors.node[j]));
+        if (bound.check(neighborSimilarity) == false) {
           // node j is too similar to node i given its score relative to the base node
           // replace it with the new node, which is at [maxConn]
           return i;
diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswVectorsReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswVectorsReader.java
index 45f5fd5308e..42a8115e1b5 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswVectorsReader.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswVectorsReader.java
@@ -253,9 +253,9 @@ public final class Lucene91HnswVectorsReader extends KnnVectorsReader {
     ScoreDoc[] scoreDocs = new ScoreDoc[Math.min(results.size(), k)];
     while (results.size() > 0) {
       int node = results.topNode();
-      float score = fieldEntry.similarityFunction.convertToScore(results.topScore());
+      float minSimilarity = results.topScore();
       results.pop();
-      scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(fieldEntry.ordToDoc(node), score);
+      scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(fieldEntry.ordToDoc(node), minSimilarity);
     }
 
     TotalHits.Relation relation =
diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsReader.java
index 4e9a6a2dd3b..1b6534f9876 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsReader.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene92/Lucene92HnswVectorsReader.java
@@ -246,9 +246,9 @@ public final class Lucene92HnswVectorsReader extends KnnVectorsReader {
     ScoreDoc[] scoreDocs = new ScoreDoc[Math.min(results.size(), k)];
     while (results.size() > 0) {
       int node = results.topNode();
-      float score = fieldEntry.similarityFunction.convertToScore(results.topScore());
+      float minSimilarity = results.topScore();
       results.pop();
-      scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(vectorValues.ordToDoc(node), score);
+      scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(vectorValues.ordToDoc(node), minSimilarity);
     }
 
     TotalHits.Relation relation =
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java
index 081503a51f8..adfab333e11 100644
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java
@@ -170,7 +170,7 @@ public class SimpleTextKnnVectorsReader extends KnnVectorsReader {
       }
 
       float[] vector = values.vectorValue();
-      float score = vectorSimilarity.convertToScore(vectorSimilarity.compare(vector, target));
+      float score = vectorSimilarity.compare(vector, target);
       topK.insertWithOverflow(new ScoreDoc(doc, score));
       numVisited++;
     }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsReader.java
index e439b7a52f0..977911efc2c 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsReader.java
@@ -246,7 +246,7 @@ public final class Lucene93HnswVectorsReader extends KnnVectorsReader {
     ScoreDoc[] scoreDocs = new ScoreDoc[Math.min(results.size(), k)];
     while (results.size() > 0) {
       int node = results.topNode();
-      float score = fieldEntry.similarityFunction.convertToScore(results.topScore());
+      float score = results.topScore();
       results.pop();
       scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(vectorValues.ordToDoc(node), score);
     }
diff --git a/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java b/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java
index a237e3d8609..0aae4b72847 100644
--- a/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java
+++ b/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java
@@ -26,15 +26,10 @@ import static org.apache.lucene.util.VectorUtil.*;
 public enum VectorSimilarityFunction {
 
   /** Euclidean distance */
-  EUCLIDEAN(true) {
+  EUCLIDEAN {
     @Override
     public float compare(float[] v1, float[] v2) {
-      return squareDistance(v1, v2);
-    }
-
-    @Override
-    public float convertToScore(float similarity) {
-      return 1 / (1 + similarity);
+      return 1 / (1 + squareDistance(v1, v2));
     }
   },
 
@@ -47,12 +42,7 @@ public enum VectorSimilarityFunction {
   DOT_PRODUCT {
     @Override
     public float compare(float[] v1, float[] v2) {
-      return dotProduct(v1, v2);
-    }
-
-    @Override
-    public float convertToScore(float similarity) {
-      return (1 + similarity) / 2;
+      return (1 + dotProduct(v1, v2)) / 2;
     }
   },
 
@@ -60,50 +50,22 @@ public enum VectorSimilarityFunction {
    * Cosine similarity. NOTE: the preferred way to perform cosine similarity is to normalize all
    * vectors to unit length, and instead use {@link VectorSimilarityFunction#DOT_PRODUCT}. You
    * should only use this function if you need to preserve the original vectors and cannot normalize
-   * them in advance.
+   * them in advance. The similarity score is normalised to assure it is positive.
    */
   COSINE {
     @Override
     public float compare(float[] v1, float[] v2) {
-      return cosine(v1, v2);
-    }
-
-    @Override
-    public float convertToScore(float similarity) {
-      return (1 + similarity) / 2;
+      return (1 + cosine(v1, v2)) / 2;
     }
   };
 
   /**
-   * If true, the scores associated with vector comparisons are nonnegative and in reverse order;
-   * that is, lower scores represent more similar vectors. Otherwise, if false, higher scores
-   * represent more similar vectors, and scores may be negative or positive.
-   */
-  public final boolean reversed;
-
-  VectorSimilarityFunction(boolean reversed) {
-    this.reversed = reversed;
-  }
-
-  VectorSimilarityFunction() {
-    reversed = false;
-  }
-
-  /**
-   * Calculates a similarity score between the two vectors with a specified function.
+   * Calculates a similarity score between the two vectors with a specified function. Higher
+   * similarity scores correspond to closer vectors.
    *
    * @param v1 a vector
    * @param v2 another vector, of the same dimension
    * @return the value of the similarity function applied to the two vectors
    */
   public abstract float compare(float[] v1, float[] v2);
-
-  /**
-   * Converts similarity scores used (may be negative, reversed, etc) into document scores, which
-   * must be positive, with higher scores representing better matches.
-   *
-   * @param similarity the raw internal score as returned by {@link #compare(float[], float[])}.
-   * @return normalizedSimilarity
-   */
-  public abstract float convertToScore(float similarity);
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java b/lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java
index bb9e80c1d63..6e68de193da 100644
--- a/lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java
@@ -197,7 +197,7 @@ public class KnnVectorQuery extends Query {
       assert vectorDoc == doc;
       float[] vector = vectorValues.vectorValue();
 
-      float score = similarityFunction.convertToScore(similarityFunction.compare(vector, target));
+      float score = similarityFunction.compare(vector, target);
       if (score >= topDoc.score) {
         topDoc.score = score;
         topDoc.doc = doc;
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java
index b611d082c96..c86b9321d7a 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java
+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java
@@ -51,7 +51,6 @@ public final class HnswGraphBuilder {
   private final VectorSimilarityFunction similarityFunction;
   private final RandomAccessVectorValues vectorValues;
   private final SplittableRandom random;
-  private final BoundsChecker bound;
   private final HnswGraphSearcher graphSearcher;
 
   final OnHeapHnswGraph hnsw;
@@ -96,15 +95,14 @@ public final class HnswGraphBuilder {
     this.ml = 1 / Math.log(1.0 * M);
     this.random = new SplittableRandom(seed);
     int levelOfFirstNode = getRandomGraphLevel(ml, random);
-    this.hnsw = new OnHeapHnswGraph(M, levelOfFirstNode, similarityFunction.reversed);
+    this.hnsw = new OnHeapHnswGraph(M, levelOfFirstNode);
     this.graphSearcher =
         new HnswGraphSearcher(
             similarityFunction,
-            new NeighborQueue(beamWidth, similarityFunction.reversed == false),
+            new NeighborQueue(beamWidth, true),
             new FixedBitSet(vectorValues.size()));
-    bound = BoundsChecker.create(similarityFunction.reversed);
     // in scratch we store candidates in reverse order: worse candidates are first
-    scratch = new NeighborArray(Math.max(beamWidth, M + 1), similarityFunction.reversed);
+    scratch = new NeighborArray(Math.max(beamWidth, M + 1), false);
   }
 
   /**
@@ -225,8 +223,8 @@ public final class HnswGraphBuilder {
     // extract all the Neighbors from the queue into an array; these will now be
     // sorted from worst to best
     for (int i = 0; i < candidateCount; i++) {
-      float score = candidates.topScore();
-      scratch.add(candidates.pop(), score);
+      float maxSimilarity = candidates.topScore();
+      scratch.add(candidates.pop(), maxSimilarity);
     }
   }
 
@@ -245,11 +243,10 @@ public final class HnswGraphBuilder {
       NeighborArray neighbors,
       RandomAccessVectorValues vectorValues)
       throws IOException {
-    bound.set(score);
     for (int i = 0; i < neighbors.size(); i++) {
-      float diversityCheck =
+      float neighborSimilarity =
           similarityFunction.compare(candidate, vectorValues.vectorValue(neighbors.node[i]));
-      if (bound.check(diversityCheck) == false) {
+      if (neighborSimilarity >= score) {
         return false;
       }
     }
@@ -261,16 +258,17 @@ public final class HnswGraphBuilder {
    * neighbours
    */
   private int findWorstNonDiverse(NeighborArray neighbors) throws IOException {
+    float minAcceptedSimilarity;
     for (int i = neighbors.size() - 1; i > 0; i--) {
       int cNode = neighbors.node[i];
       float[] cVector = vectorValues.vectorValue(cNode);
-      bound.set(neighbors.score[i]);
+      minAcceptedSimilarity = neighbors.score[i];
       // check the candidate against its better-scoring neighbors
       for (int j = i - 1; j >= 0; j--) {
-        float diversityCheck =
+        float neighborSimilarity =
             similarityFunction.compare(cVector, buildVectors.vectorValue(neighbors.node[j]));
         // node i is too similar to node j given its score relative to the base node
-        if (bound.check(diversityCheck) == false) {
+        if (neighborSimilarity >= minAcceptedSimilarity) {
           return i;
         }
       }
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java
index ba88995bd3b..59735f6be9d 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java
+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java
@@ -80,7 +80,7 @@ public final class HnswGraphSearcher {
     HnswGraphSearcher graphSearcher =
         new HnswGraphSearcher(
             similarityFunction,
-            new NeighborQueue(topK, similarityFunction.reversed == false),
+            new NeighborQueue(topK, true),
             new SparseFixedBitSet(vectors.size()));
     NeighborQueue results;
     int[] eps = new int[] {graph.entryNode()};
@@ -139,7 +139,7 @@ public final class HnswGraphSearcher {
       int visitedLimit)
       throws IOException {
     int size = graph.size();
-    NeighborQueue results = new NeighborQueue(topK, similarityFunction.reversed);
+    NeighborQueue results = new NeighborQueue(topK, false);
     clearScratchState();
 
     int numVisited = 0;
@@ -160,14 +160,14 @@ public final class HnswGraphSearcher {
 
     // A bound that holds the minimum similarity to the query vector that a candidate vector must
     // have to be considered.
-    BoundsChecker bound = BoundsChecker.create(similarityFunction.reversed);
+    float minAcceptedSimilarity = Float.NEGATIVE_INFINITY;
     if (results.size() >= topK) {
-      bound.set(results.topScore());
+      minAcceptedSimilarity = results.topScore();
     }
     while (candidates.size() > 0 && results.incomplete() == false) {
       // get the best candidate (closest or best scoring)
-      float topCandidateScore = candidates.topScore();
-      if (bound.check(topCandidateScore)) {
+      float topCandidateSimilarity = candidates.topScore();
+      if (topCandidateSimilarity < minAcceptedSimilarity) {
         break;
       }
 
@@ -184,13 +184,13 @@ public final class HnswGraphSearcher {
           results.markIncomplete();
           break;
         }
-        float score = similarityFunction.compare(query, vectors.vectorValue(friendOrd));
+        float friendSimilarity = similarityFunction.compare(query, vectors.vectorValue(friendOrd));
         numVisited++;
-        if (bound.check(score) == false) {
-          candidates.add(friendOrd, score);
+        if (friendSimilarity >= minAcceptedSimilarity) {
+          candidates.add(friendOrd, friendSimilarity);
           if (acceptOrds == null || acceptOrds.get(friendOrd)) {
-            if (results.insertWithOverflow(friendOrd, score) && results.size() >= topK) {
-              bound.set(results.topScore());
+            if (results.insertWithOverflow(friendOrd, friendSimilarity) && results.size() >= topK) {
+              minAcceptedSimilarity = results.topScore();
             }
           }
         }
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java
index a2c7253261b..50f0587bb5c 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java
+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java
@@ -30,13 +30,13 @@ import org.apache.lucene.util.NumericUtils;
 public class NeighborQueue {
 
   private enum Order {
-    NATURAL {
+    MIN_HEAP {
       @Override
       long apply(long v) {
         return v;
       }
     },
-    REVERSED {
+    MAX_HEAP {
       @Override
       long apply(long v) {
         // This cannot be just `-v` since Long.MIN_VALUE doesn't have a positive counterpart. It
@@ -56,9 +56,9 @@ public class NeighborQueue {
   // Whether the search stopped early because it reached the visited nodes limit
   private boolean incomplete;
 
-  public NeighborQueue(int initialSize, boolean reversed) {
+  public NeighborQueue(int initialSize, boolean maxHeap) {
     this.heap = new LongHeap(initialSize);
-    this.order = reversed ? Order.REVERSED : Order.NATURAL;
+    this.order = maxHeap ? Order.MAX_HEAP : Order.MIN_HEAP;
   }
 
   /** @return the number of elements in the heap */
@@ -89,32 +89,66 @@ public class NeighborQueue {
     return heap.insertWithOverflow(encode(newNode, newScore));
   }
 
+  /**
+   * Encodes the node ID and its similarity score as long, preserving the Lucene tie-breaking rule
+   * that when two scores are equals, the smaller node ID must win.
+   *
+   * <p>The most significant 32 bits represent the float score, encoded as a sortable int.
+   *
+   * <p>The less significant 32 bits represent the node ID.
+   *
+   * <p>The bits representing the node ID are complemented to guarantee the win for the smaller node
+   * Id.
+   *
+   * <p>The AND with 0xFFFFFFFFL (a long with first 32 bit as 1) is necessary to obtain a long that
+   * has
+   *
+   * <p>The most significant 32 bits to 0
+   *
+   * <p>The less significant 32 bits represent the node ID.
+   *
+   * @param node the node ID
+   * @param score the node score
+   * @return the encoded score, node ID
+   */
   private long encode(int node, float score) {
-    return order.apply((((long) NumericUtils.floatToSortableInt(score)) << 32) | node);
+    return order.apply(
+        (((long) NumericUtils.floatToSortableInt(score)) << 32) | (0xFFFFFFFFL & ~node));
+  }
+
+  private float decodeScore(long heapValue) {
+    return NumericUtils.sortableIntToFloat((int) (order.apply(heapValue) >> 32));
+  }
+
+  private int decodeNodeId(long heapValue) {
+    return (int) ~(order.apply(heapValue));
   }
 
   /** Removes the top element and returns its node id. */
   public int pop() {
-    return (int) order.apply(heap.pop());
+    return decodeNodeId(heap.pop());
   }
 
   public int[] nodes() {
     int size = size();
     int[] nodes = new int[size];
     for (int i = 0; i < size; i++) {
-      nodes[i] = (int) order.apply(heap.get(i + 1));
+      nodes[i] = decodeNodeId(heap.get(i + 1));
     }
     return nodes;
   }
 
   /** Returns the top element's node id. */
   public int topNode() {
-    return (int) order.apply(heap.top());
+    return decodeNodeId(heap.top());
   }
 
-  /** Returns the top element's node score. */
+  /**
+   * Returns the top element's node score. For the min heap this is the minimum score. For the max
+   * heap this is the maximum score.
+   */
   public float topScore() {
-    return NumericUtils.sortableIntToFloat((int) (order.apply(heap.top()) >> 32));
+    return decodeScore(heap.top());
   }
 
   public void clear() {
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java
index 1dc0845ccd5..e03a8e89e79 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java
+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java
@@ -30,7 +30,6 @@ import org.apache.lucene.util.ArrayUtil;
  */
 public final class OnHeapHnswGraph extends HnswGraph {
 
-  private final boolean similarityReversed;
   private int numLevels; // the current number of levels in the graph
   private int entryNode; // the current graph entry node on the top level
 
@@ -52,8 +51,7 @@ public final class OnHeapHnswGraph extends HnswGraph {
   private int upto;
   private NeighborArray cur;
 
-  OnHeapHnswGraph(int M, int levelOfFirstNode, boolean similarityReversed) {
-    this.similarityReversed = similarityReversed;
+  OnHeapHnswGraph(int M, int levelOfFirstNode) {
     this.numLevels = levelOfFirstNode + 1;
     this.graph = new ArrayList<>(numLevels);
     this.entryNode = 0;
@@ -63,7 +61,7 @@ public final class OnHeapHnswGraph extends HnswGraph {
     this.nsize0 = (M * 2 + 1);
     for (int l = 0; l < numLevels; l++) {
       graph.add(new ArrayList<>());
-      graph.get(l).add(new NeighborArray(l == 0 ? nsize0 : nsize, similarityReversed == false));
+      graph.get(l).add(new NeighborArray(l == 0 ? nsize0 : nsize, true));
     }
 
     this.nodesByLevel = new ArrayList<>(numLevels);
@@ -123,9 +121,7 @@ public final class OnHeapHnswGraph extends HnswGraph {
         }
       }
     }
-    graph
-        .get(level)
-        .add(new NeighborArray(level == 0 ? nsize0 : nsize, similarityReversed == false));
+    graph.get(level).add(new NeighborArray(level == 0 ? nsize0 : nsize, true));
   }
 
   @Override
diff --git a/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java b/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java
index bb659f0bded..615e15be047 100644
--- a/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java
+++ b/lucene/core/src/test/org/apache/lucene/util/hnsw/KnnGraphTester.java
@@ -276,8 +276,7 @@ public class KnnGraphTester {
     for (int i = 0; i < hnsw.size(); i++) {
       NeighborArray neighbors = hnsw.getNeighbors(0, i);
       System.out.printf(Locale.ROOT, "%5d", i);
-      NeighborArray sorted =
-          new NeighborArray(neighbors.size(), similarityFunction.reversed == false);
+      NeighborArray sorted = new NeighborArray(neighbors.size(), true);
       for (int j = 0; j < neighbors.size(); j++) {
         int node = neighbors.node[j];
         float score = neighbors.score[j];
@@ -555,7 +554,7 @@ public class KnnGraphTester {
                   .order(ByteOrder.LITTLE_ENDIAN)
                   .asFloatBuffer();
           offset += blockSize;
-          NeighborQueue queue = new NeighborQueue(topK, similarityFunction.reversed);
+          NeighborQueue queue = new NeighborQueue(topK, false);
           for (; j < numDocs && vectors.hasRemaining(); j++) {
             vectors.get(vector);
             float d = similarityFunction.compare(query, vector);
diff --git a/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java b/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
index 8e357b91898..93be8e8aa8b 100644
--- a/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
+++ b/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
@@ -309,30 +309,6 @@ public class TestHnswGraph extends LuceneTestCase {
     assertTrue(nn.visitedCount() <= visitedLimit);
   }
 
-  public void testBoundsCheckerMax() {
-    BoundsChecker max = BoundsChecker.create(false);
-    float f = random().nextFloat() - 0.5f;
-    // any float > -MAX_VALUE is in bounds
-    assertFalse(max.check(f));
-    // f is now the bound (minus some delta)
-    max.update(f);
-    assertFalse(max.check(f)); // f is not out of bounds
-    assertFalse(max.check(f + 1)); // anything greater than f is in bounds
-    assertTrue(max.check(f - 1e-5f)); // delta is zero initially
-  }
-
-  public void testBoundsCheckerMin() {
-    BoundsChecker min = BoundsChecker.create(true);
-    float f = random().nextFloat() - 0.5f;
-    // any float < MAX_VALUE is in bounds
-    assertFalse(min.check(f));
-    // f is now the bound (minus some delta)
-    min.update(f);
-    assertFalse(min.check(f)); // f is not out of bounds
-    assertFalse(min.check(f - 1)); // anything less than f is in bounds
-    assertTrue(min.check(f + 1e-5f)); // delta is zero initially
-  }
-
   public void testHnswGraphBuilderInvalid() {
     expectThrows(NullPointerException.class, () -> new HnswGraphBuilder(null, null, 0, 0, 0));
     expectThrows(
@@ -441,7 +417,7 @@ public class TestHnswGraph extends LuceneTestCase {
       while (actual.size() > topK) {
         actual.pop();
       }
-      NeighborQueue expected = new NeighborQueue(topK, similarityFunction.reversed);
+      NeighborQueue expected = new NeighborQueue(topK, false);
       for (int j = 0; j < size; j++) {
         if (vectors.vectorValue(j) != null && (acceptOrds == null || acceptOrds.get(j))) {
           expected.add(j, similarityFunction.compare(query, vectors.vectorValue(j)));