Package org.apache.lucene.index
Class IndexFileNames
- java.lang.Object
-
- org.apache.lucene.index.IndexFileNames
-
public final class IndexFileNames extends Object
This class contains useful constants representing filenames and extensions used by lucene, as well as convenience methods for querying whether a file name matches an extension (matchesExtension), as well as generating file names from a segment name, generation and extension (fileNameFromGeneration,segmentFileName).- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static String[]COMPOUND_EXTENSIONSFile extensions of old-style index filesstatic StringCOMPOUND_FILE_EXTENSIONExtension of compound filestatic StringCOMPOUND_FILE_STORE_EXTENSIONExtension of compound file for doc store filesstatic StringDELETABLEName of the index deletable file (only used in pre-lockless indices)static StringDELETES_EXTENSIONExtension of deletesstatic StringFIELD_INFOS_EXTENSIONExtension of field infosstatic StringFIELDS_EXTENSIONExtension of stored fields filestatic StringFIELDS_INDEX_EXTENSIONExtension of stored fields index filestatic StringFREQ_EXTENSIONExtension of freq postings filestatic StringGEN_EXTENSIONExtension of gen filestatic String[]INDEX_EXTENSIONSThis array contains all filename extensions used by Lucene's index files, with two exceptions, namely the extension made up from.f+ a number and from.s+ a number.static String[]INDEX_EXTENSIONS_IN_COMPOUND_FILEFile extensions that are added to a compound file (same as above, minus "del", "gen", "cfs").static String[]NON_STORE_INDEX_EXTENSIONSstatic StringNORMS_EXTENSIONExtension of norms filestatic StringPLAIN_NORMS_EXTENSIONExtension of plain normsstatic StringPROX_EXTENSIONExtension of prox postings filestatic StringSEGMENTSName of the index segment filestatic StringSEGMENTS_GENName of the generation reference file namestatic StringSEPARATE_NORMS_EXTENSIONExtension of separate normsstatic String[]STORE_INDEX_EXTENSIONSstatic StringTERMS_EXTENSIONExtension of terms filestatic StringTERMS_INDEX_EXTENSIONExtension of terms index filestatic String[]VECTOR_EXTENSIONSFile extensions for term vector supportstatic StringVECTORS_DOCUMENTS_EXTENSIONExtension of vectors documents filestatic StringVECTORS_FIELDS_EXTENSIONExtension of vectors fields filestatic StringVECTORS_INDEX_EXTENSIONExtension of vectors index file
-
Constructor Summary
Constructors Constructor Description IndexFileNames()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringfileNameFromGeneration(String base, String ext, long gen)Computes the full file name from base, extension and generation.static booleanisDocStoreFile(String fileName)Returns true if the provided filename is one of the doc store files (ends with an extension inSTORE_INDEX_EXTENSIONS).static booleanisSeparateNormsFile(String filename)Returns true if the given filename ends with the separate norms file pattern:SEPARATE_NORMS_EXTENSION + "[0-9]+".static booleanmatchesExtension(String filename, String ext)Returns true if the given filename ends with the given extension.static StringsegmentFileName(String segmentName, String ext)Returns the file name that matches the given segment name and extension.static StringstripSegmentName(String filename)Strips the segment file name out of the given one.
-
-
-
Field Detail
-
SEGMENTS
public static final String SEGMENTS
Name of the index segment file- See Also:
- Constant Field Values
-
SEGMENTS_GEN
public static final String SEGMENTS_GEN
Name of the generation reference file name- See Also:
- Constant Field Values
-
DELETABLE
public static final String DELETABLE
Name of the index deletable file (only used in pre-lockless indices)- See Also:
- Constant Field Values
-
NORMS_EXTENSION
public static final String NORMS_EXTENSION
Extension of norms file- See Also:
- Constant Field Values
-
FREQ_EXTENSION
public static final String FREQ_EXTENSION
Extension of freq postings file- See Also:
- Constant Field Values
-
PROX_EXTENSION
public static final String PROX_EXTENSION
Extension of prox postings file- See Also:
- Constant Field Values
-
TERMS_EXTENSION
public static final String TERMS_EXTENSION
Extension of terms file- See Also:
- Constant Field Values
-
TERMS_INDEX_EXTENSION
public static final String TERMS_INDEX_EXTENSION
Extension of terms index file- See Also:
- Constant Field Values
-
FIELDS_INDEX_EXTENSION
public static final String FIELDS_INDEX_EXTENSION
Extension of stored fields index file- See Also:
- Constant Field Values
-
FIELDS_EXTENSION
public static final String FIELDS_EXTENSION
Extension of stored fields file- See Also:
- Constant Field Values
-
VECTORS_FIELDS_EXTENSION
public static final String VECTORS_FIELDS_EXTENSION
Extension of vectors fields file- See Also:
- Constant Field Values
-
VECTORS_DOCUMENTS_EXTENSION
public static final String VECTORS_DOCUMENTS_EXTENSION
Extension of vectors documents file- See Also:
- Constant Field Values
-
VECTORS_INDEX_EXTENSION
public static final String VECTORS_INDEX_EXTENSION
Extension of vectors index file- See Also:
- Constant Field Values
-
COMPOUND_FILE_EXTENSION
public static final String COMPOUND_FILE_EXTENSION
Extension of compound file- See Also:
- Constant Field Values
-
COMPOUND_FILE_STORE_EXTENSION
public static final String COMPOUND_FILE_STORE_EXTENSION
Extension of compound file for doc store files- See Also:
- Constant Field Values
-
DELETES_EXTENSION
public static final String DELETES_EXTENSION
Extension of deletes- See Also:
- Constant Field Values
-
FIELD_INFOS_EXTENSION
public static final String FIELD_INFOS_EXTENSION
Extension of field infos- See Also:
- Constant Field Values
-
PLAIN_NORMS_EXTENSION
public static final String PLAIN_NORMS_EXTENSION
Extension of plain norms- See Also:
- Constant Field Values
-
SEPARATE_NORMS_EXTENSION
public static final String SEPARATE_NORMS_EXTENSION
Extension of separate norms- See Also:
- Constant Field Values
-
GEN_EXTENSION
public static final String GEN_EXTENSION
Extension of gen file- See Also:
- Constant Field Values
-
INDEX_EXTENSIONS
public static final String[] INDEX_EXTENSIONS
This array contains all filename extensions used by Lucene's index files, with two exceptions, namely the extension made up from.f+ a number and from.s+ a number. Also note that Lucene'ssegments_Nfiles do not have any filename extension.
-
INDEX_EXTENSIONS_IN_COMPOUND_FILE
public static final String[] INDEX_EXTENSIONS_IN_COMPOUND_FILE
File extensions that are added to a compound file (same as above, minus "del", "gen", "cfs").
-
STORE_INDEX_EXTENSIONS
public static final String[] STORE_INDEX_EXTENSIONS
-
NON_STORE_INDEX_EXTENSIONS
public static final String[] NON_STORE_INDEX_EXTENSIONS
-
COMPOUND_EXTENSIONS
public static final String[] COMPOUND_EXTENSIONS
File extensions of old-style index files
-
VECTOR_EXTENSIONS
public static final String[] VECTOR_EXTENSIONS
File extensions for term vector support
-
-
Method Detail
-
fileNameFromGeneration
public static final String fileNameFromGeneration(String base, String ext, long gen)
Computes the full file name from base, extension and generation. If the generation is -1, the file name is null. If it's 0, the file name is <base>.<ext>. If it's > 0, the file name is <base>_<gen>.<ext>.
NOTE: .<ext> is added to the name only ifextis not an empty string.- Parameters:
base- main part of the file nameext- extension of the filenamegen- generation
-
isDocStoreFile
public static final boolean isDocStoreFile(String fileName)
Returns true if the provided filename is one of the doc store files (ends with an extension inSTORE_INDEX_EXTENSIONS).
-
segmentFileName
public static final String segmentFileName(String segmentName, String ext)
Returns the file name that matches the given segment name and extension. This method takes care to return the full file name in the form <segmentName>.<ext>, therefore you don't need to prefix the extension with a '.'.
NOTE: .<ext> is added to the result file name only ifextis not empty.
-
matchesExtension
public static final boolean matchesExtension(String filename, String ext)
Returns true if the given filename ends with the given extension. One should provide a pure extension, without '.'.
-
stripSegmentName
public static final String stripSegmentName(String filename)
Strips the segment file name out of the given one. If you usedsegmentFileName(java.lang.String, java.lang.String)orfileNameFromGeneration(java.lang.String, java.lang.String, long)to create your files, then this method simply removes whatever comes before the first '.', or the second '_' (excluding both), in case of deleted docs.- Returns:
- the filename with the segment name removed, or the given filename if it does not contain a '.' and '_'.
-
isSeparateNormsFile
public static boolean isSeparateNormsFile(String filename)
Returns true if the given filename ends with the separate norms file pattern:SEPARATE_NORMS_EXTENSION + "[0-9]+".
-
-