benwtrent commented on code in PR #12050:
URL: https://github.com/apache/lucene/pull/12050#discussion_r1092319484


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java:
##########
@@ -56,6 +56,8 @@ 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);

Review Comment:
   It is nice to have a static thing like this. But, 
`EMPTY_MAX_HEAP_NEIGHBOR_QUEUE#add(int float)` is possible. This seems 
dangerous to me as somebody might accidentally call `search` and then add 
values to this static object.
   
   If we are going to have a static object like this, it would be good if it 
was `EmptyNeighborQueue` that disallows `add` or any mutable action. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to