kaivalnp opened a new pull request, #12866:
URL: https://github.com/apache/lucene/pull/12866

   ### Description
   
   
[`#findBestEntryPoint`](https://github.com/apache/lucene/blob/4bc7850465dfac9dc0638d9ee782007883869ffe/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java#L151)
 is used to determine the entry point for the last level of HNSW search
   
   It finds the single best-scoring node from [all upper 
levels](https://github.com/apache/lucene/blob/4bc7850465dfac9dc0638d9ee782007883869ffe/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java#L159)
 - but performs an [unnecessary 
computation](https://github.com/apache/lucene/blob/4bc7850465dfac9dc0638d9ee782007883869ffe/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java#L157)
 (along with [recording one visited 
node](https://github.com/apache/lucene/blob/4bc7850465dfac9dc0638d9ee782007883869ffe/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java#L154))
 when the graph just has 1 level (so the entry node is just the overall graph's 
entry node)
   
   Also added a test to demonstrate this (fails without the changes in PR) -- 
where we visit `graph.size() + 1` nodes when the `topK` is high (should be a 
maximum of `graph.size()`)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to