It'd be a challenge, but it is possible. It's just software ;) You need something like this to read a SegmentInfo from your sole .si file, assuming you are on a recent 5.x release:
SegmentInfo info = codec.segmentInfoFormat().read(directory, segName, segmentID, IOContext.READ); To get codec, assuming you used the default codec for indexing, use: Codec codec = Codec.getDefault(); Then do something like this: SegmentInfos infos = new SegmentInfos(); infos.add(info); infos.commit(directory); The latter method is package private, so your tool must live in org.apache.lucene.index package, or use break-out-of-jail magic with Java's reflection APIs. Then run CheckIndex on that ... if it fails, iterate with the above code! Good luck, Mike McCandless http://blog.mikemccandless.com On Tue, Feb 9, 2016 at 9:50 AM, <khanh-lam....@bnf.fr> wrote: > Hello, > > First, I don't know if it's the right mailing list to ask for your help, > if no please accept my apologies for the inconvenience. > > While moving Lucene (5.3) index files from a server to an other, I forgot > to move the segments_N file (because I use the pattern *.*) > Unfortunately I've erased the original folder, and I only have these files > in my directory now : > > _1rpt.fdt > _1rpt.fdx > _1rpt.fnm > _1rpt.nvd > _1rpt.nvm > _1rpt.si > _1rpt_Lucene50_0.doc > _1rpt_Lucene50_0.dvd > _1rpt_Lucene50_0.dvm > _1rpt_Lucene50_0.pos > _1rpt_Lucene50_0.tim > _1rpt_Lucene50_0.tip > write.lock > > I am missing the segments_42u file, and without it I cannot even do an > org.apache.lucene.index.CheckIndex : > > Exception in thread "main" org.apache.lucene.index.IndexNotFoundException: > no segments* file found in MMapDirectory@/solr-5.3.1 > /nodes/node1/core/data/index lockFactory=org.apache.lucene.store. > NativeFSLockFactory@119d7047: files: [write.lock, _1rpt.fdt, _1rpt.fdx, > _1rpt.fnm, _1rpt.nvd, _1rpt.nvm, _1rpt.si, _1rpt_Lucene50_0.doc, > _1rpt_Lucene50_0.dvd, _1rpt_Lucene50_0.dvm, _1rpt_Lucene50_0.pos, > _1rpt_Lucene50_0.tim, _1rpt_Lucene50_0.tip] > at org.apache.lucene.index.CheckIndex.checkIndex(CheckIndex.java:483) > at org.apache.lucene.index.CheckIndex.doMain(CheckIndex.java:2354) > at org.apache.lucene.index.CheckIndex.main(CheckIndex.java:2237) > > The index is pretty huge (> 800GB) and it will take weeks to rebuild it. > Is there a way to generate this missing segment info file ? > > Thanks a lot for your help. > > > Khanh-Lam Mai > khanh-lam....@bnf.fr > Exposition De Rouge et de Noir. Les vases grecs de la collection de Luynes > - jusqu'au 1 er mars 2016 - BnF - Richelieu Avant d'imprimer, pensez à > l'environnement. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org