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

this is an easy-to-use tool that upgrades all segments of an index from previous Lucene versions to the current segment file format. It can be used from command line:
 java -cp lucene-core.jar Lucene.Net.Index.IndexUpgrader [-delete-prior-commits] [-verbose] indexDir 
Alternatively this class can be instantiated and #upgrade invoked. It uses UpgradeIndexMergePolicy and triggers the upgrade via an forceMerge request to IndexWriter.

this tool keeps only the last commit in an index; for this reason, if the incoming index has more than one commit, the tool refuses to run by default. Specify {@code -delete-prior-commits} to override this, allowing the tool to delete all but the last commit. From Java code this can be enabled by passing {@code true} to #IndexUpgrader(Directory,Version,StreamWriter,boolean).

Warning: this tool may reorder documents if the index was partially upgraded before execution (e.g., documents were added). If your application relies on "monotonicity" of doc IDs (which means that the order in which the documents were added to the index is preserved), do a full forceMerge instead. The MergePolicy set by IndexWriterConfig may also reorder documents.

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

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

Метод Описание
IndexUpgrader ( Directory dir, IndexWriterConfig iwc, bool deletePriorCommits ) : System

Creates index upgrader on the given directory, using an IndexWriter using the given config. You have the possibility to upgrade indexes with multiple commit points by removing all older ones.

IndexUpgrader ( Directory dir, System.Version matchVersion ) : System

Creates index upgrader on the given directory, using an IndexWriter using the given {@code matchVersion}. The tool refuses to upgrade indexes with multiple commit points.

IndexUpgrader ( Directory dir, System.Version matchVersion, TextWriter infoStream, bool deletePriorCommits ) : System

Creates index upgrader on the given directory, using an IndexWriter using the given {@code matchVersion}. You have the possibility to upgrade indexes with multiple commit points by removing all older ones. If {@code infoStream} is not {@code null}, all logging output will be sent to this stream.

ParseArgs ( string args ) : IndexUpgrader

Main method to run {code IndexUpgrader} from the command-line.

Upgrade ( ) : void

Perform the upgrade.

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

Метод Описание
PrintUsage ( ) : void

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

IndexUpgrader() публичный Метод

Creates index upgrader on the given directory, using an IndexWriter using the given config. You have the possibility to upgrade indexes with multiple commit points by removing all older ones.
public IndexUpgrader ( Directory dir, IndexWriterConfig iwc, bool deletePriorCommits ) : System
dir System.IO.Directory
iwc IndexWriterConfig
deletePriorCommits bool
Результат System

IndexUpgrader() публичный Метод

Creates index upgrader on the given directory, using an IndexWriter using the given {@code matchVersion}. The tool refuses to upgrade indexes with multiple commit points.
public IndexUpgrader ( Directory dir, System.Version matchVersion ) : System
dir System.IO.Directory
matchVersion System.Version
Результат System

IndexUpgrader() публичный Метод

Creates index upgrader on the given directory, using an IndexWriter using the given {@code matchVersion}. You have the possibility to upgrade indexes with multiple commit points by removing all older ones. If {@code infoStream} is not {@code null}, all logging output will be sent to this stream.
public IndexUpgrader ( Directory dir, System.Version matchVersion, TextWriter infoStream, bool deletePriorCommits ) : System
dir System.IO.Directory
matchVersion System.Version
infoStream System.IO.TextWriter
deletePriorCommits bool
Результат System

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

Main method to run {code IndexUpgrader} from the command-line.
public static ParseArgs ( string args ) : IndexUpgrader
args string
Результат IndexUpgrader

Upgrade() публичный Метод

Perform the upgrade.
public Upgrade ( ) : void
Результат void