uschindler commented on code in PR #13267: URL: https://github.com/apache/lucene/pull/13267#discussion_r1552390907
########## lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatVectorsWriter.java: ########## @@ -315,10 +316,13 @@ public CloseableRandomVectorScorerSupplier mergeOneFieldToIndex( CodecUtil.writeFooter(tempVectorData); IOUtils.close(tempVectorData); - // copy the temporary file vectors to the actual data file + // This temp file will be accessed in a random-access fashion to construct the HNSW graph. + // Note: don't use the context from the state, which is a flush/merge context, not expecting + // to perform random reads. vectorDataInput = segmentWriteState.directory.openInput( - tempVectorData.getName(), segmentWriteState.context); + tempVectorData.getName(), IOContext.DEFAULT.withRandomAccess()); Review Comment: Here you could also use `IOContext.RANDOM` directly. ########## lucene/core/src/java/org/apache/lucene/store/IOContext.java: ########## @@ -132,10 +132,24 @@ public IOContext(IOContext ctxt, boolean readOnce) { this.mergeInfo = ctxt.mergeInfo; this.flushInfo = ctxt.flushInfo; this.readOnce = readOnce; - this.randomAccess = ctxt.randomAccess; + this.randomAccess = false; Review Comment: I think this should be documented. -- 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