benwtrent commented on code in PR #15607:
URL: https://github.com/apache/lucene/pull/15607#discussion_r2728844272
##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java:
##########
@@ -470,12 +476,17 @@ static void popToScratch(GraphBuilderKnnCollector
candidates, NeighborArray scra
*/
private boolean diversityCheck(float score, NeighborArray neighbors,
RandomVectorScorer scorer)
throws IOException {
+ int bulkCount = 0;
for (int i = 0; i < neighbors.size(); i++) {
- float neighborSimilarity = scorer.score(neighbors.nodes()[i]);
- if (neighborSimilarity >= score) {
- return false;
+ bulkScoreNodes[bulkCount++] = neighbors.nodes()[i];
Review Comment:
Thinking about this more, doing `8` always, even if there are only 8
connections seems foolish. I will benchmark with
`Math.min((neighbors.nodes().length + 1)/2, bulkScoreNodes.length))`.
--
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]