You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by so...@apache.org on 2024/10/03 14:42:07 UTC
(lucene) 01/02: add infostream status messages to HnswGraphBuilder.connectComponents (#13849)
This is an automated email from the ASF dual-hosted git repository.
sokolov pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 8c9204d1cc003ade547cf67c88916ab088b2f5b4
Author: Michael Sokolov <so...@falutin.net>
AuthorDate: Wed Oct 2 11:27:48 2024 -0400
add infostream status messages to HnswGraphBuilder.connectComponents (#13849)
---
.../org/apache/lucene/util/hnsw/HnswGraphBuilder.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java
index 1f5253ef7f8..317814e4604 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java
+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java
@@ -439,7 +439,11 @@ public class HnswGraphBuilder implements HnswBuilder {
maxConn *= 2;
}
List<Component> components = HnswUtil.components(hnsw, level, notFullyConnected, maxConn);
- // System.out.println("HnswGraphBuilder.connectComponents level=" + level + ": " + components);
+ if (infoStream.isEnabled(HNSW_COMPONENT)) {
+ infoStream.message(
+ HNSW_COMPONENT, "connect " + components.size() + " components on level=" + level);
+ }
+ // System.out.println("HnswGraphBuilder. level=" + level + ": " + components);
boolean result = true;
if (components.size() > 1) {
// connect other components to the largest one
@@ -457,6 +461,10 @@ public class HnswGraphBuilder implements HnswBuilder {
if (c.start() == NO_MORE_DOCS) {
continue;
}
+ if (infoStream.isEnabled(HNSW_COMPONENT)) {
+ infoStream.message(HNSW_COMPONENT, "connect component " + c + " to " + c0);
+ }
+
beam.clear();
eps[0] = c0.start();
RandomVectorScorer scorer = scorerSupplier.scorer(c.start());
@@ -475,8 +483,14 @@ public class HnswGraphBuilder implements HnswBuilder {
// System.out.println("link " + c0 + "." + c0node + " to " + c + "." + c.start());
link(level, c0node, c.start(), score, notFullyConnected);
linked = true;
+ if (infoStream.isEnabled(HNSW_COMPONENT)) {
+ infoStream.message(HNSW_COMPONENT, "connected ok " + c0node + " -> " + c.start());
+ }
}
if (!linked) {
+ if (infoStream.isEnabled(HNSW_COMPONENT)) {
+ infoStream.message(HNSW_COMPONENT, "not connected; no free nodes found");
+ }
result = false;
}
}