zhaih commented on code in PR #12480:
URL: https://github.com/apache/lucene/pull/12480#discussion_r1281148123


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborArray.java:
##########
@@ -111,6 +129,12 @@ public int[] sort() {
   private int insertSortedInternal() {

Review Comment:
   > why not pass the function to the NeighborArray#sort() method?
   
   Yeah +1
   
   > This obviates the need for any additional structures, if score==-1 
calculate via the method provided to sort().
   
   I have one concern for this, that `-1` might be a valid score itself, but we 
can always have an additional integer, like `noScoreIndex` or so, to indicate 
upto which index we haven't calculated the score. (Because those nodes will 
always be sit in the front of the score array)
   
   > Though it probably won't be BiFunction<Integer, Integer, Float> but 
instead a Function<Integer, Float> as only the caller will know which is the 
"current" node for the neighbor array. Or even better, a custom functional 
interface that works on native values int -> float
   
   +1, thanks for a more detailed thinking!



-- 
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