LantaoJin commented on code in PR #16879:
URL: https://github.com/apache/lucene/pull/16879#discussion_r4673858109


##########
lucene/core/src/java/org/apache/lucene/index/SlowCompositeCodecReaderWrapper.java:
##########
@@ -791,7 +794,8 @@ public KnnVectorsReader getVectorReader() {
     return new SlowCompositeKnnVectorsReaderWrapper(codecReaders, docStarts);
   }
 
-  private static class SlowCompositeKnnVectorsReaderWrapper extends 
KnnVectorsReader {
+  private static class SlowCompositeKnnVectorsReaderWrapper extends 
KnnVectorsReader

Review Comment:
   Done, with one twist: the merger casts to `SortingCodecReader`'s vectors 
reader rather than to the composite one. The merger never sees the composite 
directly, since `IndexWriter` always wraps it in a `SortingCodecReader`, and 
the single-segment case (`addIndexes(SortingCodecReader.wrap(segment, ...))`) 
has no composite at all. The merger is also in `org.apache.lucene.util.hnsw`, 
so it cannot see package-private classes of `org.apache.lucene.index`.
   
   So `SortingCodecReader`'s anonymous vectors reader became 
`SortingCodecReader.SortingKnnVectorsReader` (public, `@lucene.internal`), and 
`IncrementalHnswGraphMerger.addReader` checks for it. When its delegate is the 
composite reader, it casts to it, which is now package-private as you 
suggested, and returns its sub-readers. The composite class stays hidden.



-- 
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