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 7d818bfb968f..4857d5b9d577 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 @@ -104,7 +104,7 @@ public static NeighborQueue search( int initialEp = graph.entryNode(); if (initialEp == -1) { - return NeighborQueue.EMPTY_MAX_HEAP_NEIGHBOR_QUEUE; + return new NeighborQueue(1, true); } int[] eps = new int[] {initialEp}; int numVisited = 0; 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 6308f4226f5a..bcc43435872b 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 @@ -56,8 +56,6 @@ long apply(long v) { // Whether the search stopped early because it reached the visited nodes limit private boolean incomplete; - public static final NeighborQueue EMPTY_MAX_HEAP_NEIGHBOR_QUEUE = new NeighborQueue(1, true); - public NeighborQueue(int initialSize, boolean maxHeap) { this.heap = new LongHeap(initialSize); this.order = maxHeap ? Order.MAX_HEAP : Order.MIN_HEAP;