msokolov commented on code in PR #13984: URL: https://github.com/apache/lucene/pull/13984#discussion_r1904101920
########## lucene/core/src/java/org/apache/lucene/index/CheckIndex.java: ########## @@ -2746,6 +2785,191 @@ public static Status.VectorValuesStatus testVectors( return status; } + /** Test the HNSW graph. */ + public static Status.HnswGraphsStatus testHnswGraphs( + CodecReader reader, PrintStream infoStream, boolean failFast) throws IOException { + if (infoStream != null) { + infoStream.print(" test: hnsw graphs........."); + } + long startNS = System.nanoTime(); + Status.HnswGraphsStatus status = new Status.HnswGraphsStatus(); + KnnVectorsReader vectorsReader = reader.getVectorReader(); + FieldInfos fieldInfos = reader.getFieldInfos(); + + try { + if (fieldInfos.hasVectorValues()) { + for (FieldInfo fieldInfo : fieldInfos) { + if (fieldInfo.hasVectorValues()) { + if (vectorsReader instanceof PerFieldKnnVectorsFormat.FieldsReader) { + KnnVectorsReader fieldReader = + ((PerFieldKnnVectorsFormat.FieldsReader) vectorsReader) + .getFieldReader(fieldInfo.name); + if (fieldReader instanceof HnswGraphProvider) { + HnswGraph hnswGraph = ((HnswGraphProvider) fieldReader).getGraph(fieldInfo.name); + testHnswGraph(hnswGraph, fieldInfo.name, status); + } + } + } + } + } + msg( + infoStream, + String.format( + Locale.ROOT, + "OK [%d fields] [took %.3f sec]", + status.hnswGraphsStatusByField.size(), + nsToSec(System.nanoTime() - startNS))); + printHnswInfo(infoStream, status.hnswGraphsStatusByField); + } catch (Throwable e) { Review Comment: I think it should be enough to catch Exception here and let an outer frame handle Errors -- 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