Checking a few of the implementations, the general rule seems to be that sliced IndexInput instances don't get closed or the close operation is a no-op.
For example, in NIOFSIndexInput, the slice constructor sets isClone to true, which make the close() method a no-op: https://github.com/apache/lucene/blob/7e20d5b3aad13739a2ae9fa36774e68ccae43ac4/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java#L123 Similarly, for DirectIOIndexInput, the slice constructor sets isClosable to false, which makes close() a no-op: https://github.com/apache/lucene/blob/f8fac44b321ee089571f1cee31fa1d90046d7c01/lucene/misc/src/java/org/apache/lucene/misc/store/DirectIODirectory.java#L330 ByteBuffersIndexInput has a close() method that doesn't close anything (since ByteBuffersDataInput isn't closeable): https://github.com/apache/lucene/blob/cfdd20f5bc8387ba24653ca2ba15aa5be10d0ae0/lucene/core/src/java/org/apache/lucene/store/ByteBuffersIndexInput.java#L37 So, the implicit contract seems to be that it's okay to close a sliced IndexInput, but it's not necessary. Hope that helps, Froh On Fri, Mar 28, 2025 at 5:26 PM 기준 <0ctopus13pr...@gmail.com> wrote: > Hi all, hope you are doing great. > > Wondering what is the contract of `close` of sliced IndexInput? > Could not find any related documents wrt this. > > I find many places in Lucene do not close sliced IndexInput, and when > cleaning resources, it just close origin IndexInput. > > Would appreciate it if someone could help clarify the contract. > Fundamental question is that can we skip calling `close` a sliced > IndexInput?? > > Thank you >