msokolov commented on PR #12255: URL: https://github.com/apache/lucene/pull/12255#issuecomment-1553104616
OK I think I see the problem -- when we search the upper levels of the graph we do so using topK=1. This initializes the NeighborQueue to have "initialSize=1" and therefore its LongHeap is created with maxSize=1, and this is never changed when we clear() these data structures. But when we search the bottom layer of the graph we want to use topK=topK as passed by the caller. So I guess we could re-use the same NeighborQueue for the upper graph layers, but we really do a need to set the maxSize of the heap larger for the bottom layer, and it seems as if we might as well just create a new heap. I guess some of the confusion arises because this data structure is sometimes used in a fixed-size way (we only insert nodes using insertWithOverflow into the results) and in other usages we allow it grow without bound (we insert nodes into the candidate queue using add). -- 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