/** Returns the generation from this file name, or 0 if there is no * generation. */ public static long parseGeneration(String filename) { assert filename.startsWith("_"); String parts[] = stripExtension(filename).substring(1).split("_"); // 4 cases: // segment.ext // segment_gen.ext // segment_codec_suffix.ext // segment_gen_codec_suffix.ext if (parts.length == 2 || parts.length == 4) { return Long.parseLong(parts[1], Character.MAX_RADIX); } else { return 0; } }
/** Returns the generation from this file name, or 0 if there is no * generation. */ public static long parseGeneration(String filename) { assert filename.startsWith("_"); String parts[] = stripExtension(filename).substring(1).split("_"); // 4 cases: // segment.ext // segment_gen.ext // segment_codec_suffix.ext // segment_gen_codec_suffix.ext if (parts.length == 2 || parts.length == 4) { return Long.parseLong(parts[1], Character.MAX_RADIX); } else { return 0; } }
/** Returns the generation from this file name, or 0 if there is no * generation. */ public static long parseGeneration(String filename) { assert filename.startsWith("_"); String parts[] = stripExtension(filename).substring(1).split("_"); // 4 cases: // segment.ext // segment_gen.ext // segment_codec_suffix.ext // segment_gen_codec_suffix.ext if (parts.length == 2 || parts.length == 4) { return Long.parseLong(parts[1], Character.MAX_RADIX); } else { return 0; } }
/** Returns the generation from this file name, or 0 if there is no * generation. */ public static long parseGeneration(String filename) { assert filename.startsWith("_"); String parts[] = stripExtension(filename).substring(1).split("_"); // 4 cases: // segment.ext // segment_gen.ext // segment_codec_suffix.ext // segment_gen_codec_suffix.ext if (parts.length == 2 || parts.length == 4) { return Long.parseLong(parts[1], Character.MAX_RADIX); } else { return 0; } }
/** * Create the compound stream in the specified file. The file name is the * entire name (no extensions are added). * * @throws NullPointerException * if <code>dir</code> or <code>name</code> is null */ Lucene40CompoundWriter(Directory dir, String name, IOContext context) { if (dir == null) throw new NullPointerException("directory cannot be null"); if (name == null) throw new NullPointerException("name cannot be null"); directory = dir; entryTableName = IndexFileNames.segmentFileName( IndexFileNames.stripExtension(name), "", Lucene40CompoundFormat.COMPOUND_FILE_ENTRIES_EXTENSION); dataFileName = name; this.context = context; }
assert FIELD_INFOS_FILE_EXTENSION.equals(extension) == false || IndexFileNames.stripExtension(IndexFileNames.stripSegmentName(meta.name())).isEmpty() : "FieldInfos are generational but updateable DV are not supported in elasticsearch"; if (IndexFileNames.SEGMENTS.equals(segmentId) || DEL_FILE_EXTENSION.equals(extension) || LIV_FILE_EXTENSION.equals(extension)) {
assert FIELD_INFOS_FILE_EXTENSION.equals(extension) == false || IndexFileNames.stripExtension(IndexFileNames.stripSegmentName(meta.name())).isEmpty() : "FieldInfos are generational but updateable DV are not supported in elasticsearch"; if (IndexFileNames.SEGMENTS.equals(segmentId) || DEL_FILE_EXTENSION.equals(extension) || LIV_FILE_EXTENSION.equals(extension)) {
try { final String entriesFileName = IndexFileNames.segmentFileName( IndexFileNames.stripExtension(name), "", Lucene40CompoundFormat.COMPOUND_FILE_ENTRIES_EXTENSION); entriesStream = dir.openChecksumInput(entriesFileName, IOContext.READONCE);