Hi Ishan,

The proper way of doing this would be to create this file as part of a file
format, or add a new file format to the codec for the data that you'd like
to track as part of the segment.

Doing it outside of a file format feels like it is not going to work
properly, e.g. what should happen to this file if the segment gets merged
away. There may be interesting interactions with compound files as well.

On Thu, Mar 13, 2025 at 11:18 AM Ishan Chattopadhyaya <
ichattopadhy...@gmail.com> wrote:

> Hi all,
>
> Is there a way to place a file in the Lucene directory and make Lucene
> believe that it is part of the segment/index? I'm assuming FSDirectory is
> being used (NIOFSDirectory for example).
>
> One way I see is to use Directory#createOutput() and copy contents or use
> copy from(). But both require copying bytes, and I want to avoid it.
>
> I'm looking at SegmentState#segmentInfos and it has a
> set(Collection<File>) and addFile() methods. Would they work?
>
> Thanks and regards,
> Ishan
>


-- 
Adrien

Reply via email to