Class 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 Upgrade
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 -delete-prior-commits
to override this, allowing the tool to delete all but the last commit.
From .NET code this can be enabled by passing true
to
Index
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 Merge
Inheritance
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public sealed class IndexUpgrader : object
Constructors
| Improve this Doc View SourceIndexUpgrader(Directory, IndexWriterConfig, Boolean)
Creates index upgrader on the given directory, using an Index
Declaration
public IndexUpgrader(Directory dir, IndexWriterConfig iwc, bool deletePriorCommits)
Parameters
Type | Name | Description |
---|---|---|
Directory | dir | |
Index |
iwc | |
System. |
deletePriorCommits |
IndexUpgrader(Directory, LuceneVersion)
Creates index upgrader on the given directory, using an IndexmatchVersion
. The tool refuses to upgrade indexes with multiple commit points.
Declaration
public IndexUpgrader(Directory dir, LuceneVersion matchVersion)
Parameters
Type | Name | Description |
---|---|---|
Directory | dir | |
Lucene |
matchVersion |
IndexUpgrader(Directory, LuceneVersion, TextWriter, Boolean)
Creates index upgrader on the given directory, using an IndexmatchVersion
. You have the possibility to upgrade indexes with multiple commit points by removing
all older ones. If infoStream
is not null
, all logging output will be sent to this stream.
Declaration
public IndexUpgrader(Directory dir, LuceneVersion matchVersion, TextWriter infoStream, bool deletePriorCommits)
Parameters
Type | Name | Description |
---|---|---|
Directory | dir | |
Lucene |
matchVersion | |
Text |
infoStream | |
System. |
deletePriorCommits |
Methods
| Improve this Doc View SourceMain(String[])
Main method to run Index
Declaration
public static void Main(string[] args)
Parameters
Type | Name | Description |
---|---|---|
System. |
args |
ParseArgs(String[])
Declaration
public static IndexUpgrader ParseArgs(string[] args)
Parameters
Type | Name | Description |
---|---|---|
System. |
args |
Returns
Type | Description |
---|---|
Index |
Upgrade()
Perform the upgrade.
Declaration
public void Upgrade()