uschindler commented on code in PR #13229: URL: https://github.com/apache/lucene/pull/13229#discussion_r1542132603
########## lucene/core/src/java/org/apache/lucene/store/IOContext.java: ########## @@ -88,4 +84,18 @@ public IOContext(MergeInfo mergeInfo) { // Merges read input segments sequentially. this(Context.MERGE, mergeInfo, null, ReadAdvice.SEQUENTIAL); } + + /** + * Return an updated {@link IOContext} that has the provided {@link ReadAdvice} if the {@link + * Context} is a {@link Context#READ} context, otherwise return this existing instance. This helps + * preserve a {@link ReadAdvice#SEQUENTIAL} advice for merging, which is always the right choice, + * while allowing {@link IndexInput}s open for searching to use arbitrary {@link ReadAdvice}s. + */ + public IOContext toReadAdvice(ReadAdvice advice) { + if (context == Context.READ) { Review Comment: I think "withReadAdvice" sounds better, because we do not convert to a readAdvice, but we create a new context with different readAdvice. Maybe native speakers can suggest a better name. -- 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