C# Класс Lucene.Net.Index.IndexFileNames

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 ({@link #matchesExtension(String, String) matchesExtension}), as well as generating file names from a segment name, generation and extension ( #fileNameFromGeneration(String, String, long) fileNameFromGeneration, #segmentFileName(String, String, String) segmentFileName).

NOTE: extensions used by codecs are not listed here. You must interact with the Codec directly. @lucene.internal

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
CODEC_FILE_PATTERN System.Text.RegularExpressions.Regex
INDEX_EXTENSIONS string[]
SEGMENTS_GEN string

Открытые методы

Метод Описание
FileNameFromGeneration ( string @base, string ext, long gen ) : string

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 if ext is not an empty string.

GetExtension ( string filename ) : string

Return the extension (anything after the first '.'), or null if there is no '.' in the file name.

MatchesExtension ( string filename, string ext ) : bool

Returns true if the given filename ends with the given extension. One should provide a pure extension, without '.'.

ParseSegmentName ( string filename ) : string

Parses the segment name out of the given file name.

SegmentFileName ( string segmentName, string segmentSuffix, string ext ) : string

Returns a file name that includes the given segment name, your own custom name and extension. The format of the filename is: <segmentName>(_<name>)(.<ext>).

NOTE: .<ext> is added to the result file name only if ext is not empty.

NOTE: _<segmentSuffix> is added to the result file name only if it's not the empty string

NOTE: all custom files should be named using this method, or otherwise some structures may fail to handle them properly (such as if they are added to compound files).

StripExtension ( string filename ) : string

Removes the extension (anything after the first '.'), otherwise returns the original filename.

StripSegmentName ( string filename ) : string

Strips the segment name out of the given file name. If you used #segmentFileName or #fileNameFromGeneration to create your files, then this method simply removes whatever comes before the first '.', or the second '_' (excluding both).

Приватные методы

Метод Описание
IndexFileNames ( ) : System.Diagnostics

No instance

IndexOfSegmentName ( string filename ) : int

locates the boundary of the segment name, or -1

Описание методов

FileNameFromGeneration() публичный статический Метод

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 if ext is not an empty string.
public static FileNameFromGeneration ( string @base, string ext, long gen ) : string
@base string
ext string extension of the filename
gen long generation
Результат string

GetExtension() публичный статический Метод

Return the extension (anything after the first '.'), or null if there is no '.' in the file name.
public static GetExtension ( string filename ) : string
filename string
Результат string

MatchesExtension() публичный статический Метод

Returns true if the given filename ends with the given extension. One should provide a pure extension, without '.'.
public static MatchesExtension ( string filename, string ext ) : bool
filename string
ext string
Результат bool

ParseSegmentName() публичный статический Метод

Parses the segment name out of the given file name.
public static ParseSegmentName ( string filename ) : string
filename string
Результат string

SegmentFileName() публичный статический Метод

Returns a file name that includes the given segment name, your own custom name and extension. The format of the filename is: <segmentName>(_<name>)(.<ext>).

NOTE: .<ext> is added to the result file name only if ext is not empty.

NOTE: _<segmentSuffix> is added to the result file name only if it's not the empty string

NOTE: all custom files should be named using this method, or otherwise some structures may fail to handle them properly (such as if they are added to compound files).

public static SegmentFileName ( string segmentName, string segmentSuffix, string ext ) : string
segmentName string
segmentSuffix string
ext string
Результат string

StripExtension() публичный статический Метод

Removes the extension (anything after the first '.'), otherwise returns the original filename.
public static StripExtension ( string filename ) : string
filename string
Результат string

StripSegmentName() публичный статический Метод

Strips the segment name out of the given file name. If you used #segmentFileName or #fileNameFromGeneration to create your files, then this method simply removes whatever comes before the first '.', or the second '_' (excluding both).
public static StripSegmentName ( string filename ) : string
filename string
Результат string

Описание свойств

CODEC_FILE_PATTERN публичное статическое свойство

All files created by codecs much match this pattern (checked in SegmentInfo).
public static Regex,System.Text.RegularExpressions CODEC_FILE_PATTERN
Результат System.Text.RegularExpressions.Regex

INDEX_EXTENSIONS публичное статическое свойство

this array contains all filename extensions used by Lucene's index files, with one exception, namely the extension made up from .s + a number. Also note that Lucene's segments_N files do not have any filename extension.
public static string[] INDEX_EXTENSIONS
Результат string[]

SEGMENTS_GEN публичное статическое свойство

Name of the generation reference file name
public static string SEGMENTS_GEN
Результат string