Fork me on GitHub
  • API

    Show / Hide Table of Contents

    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.

    LUCENENET specific: In the Java implementation, this class' Main method was intended to be called from the command line. However, in .NET a method within a DLL can't be directly called from the command line so we provide a .NET tool, lucene-cli, with a command that maps to that method: index upgrade

    Alternatively this class can be instantiated and Upgrade() invoked. It uses UpgradeIndexMergePolicy and triggers the upgrade via an ForceMerge(int) 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 -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 IndexUpgrader(Directory, LuceneVersion, TextWriter, bool).

    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.
    Inheritance
    object
    IndexUpgrader
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class IndexUpgrader

    Constructors

    IndexUpgrader(Directory, IndexWriterConfig, bool)

    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.

    Declaration
    public IndexUpgrader(Directory dir, IndexWriterConfig iwc, bool deletePriorCommits)
    Parameters
    Type Name Description
    Directory dir
    IndexWriterConfig iwc
    bool deletePriorCommits

    IndexUpgrader(Directory, LuceneVersion)

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

    Declaration
    public IndexUpgrader(Directory dir, LuceneVersion matchVersion)
    Parameters
    Type Name Description
    Directory dir
    LuceneVersion matchVersion

    IndexUpgrader(Directory, LuceneVersion, TextWriter, bool)

    Creates index upgrader on the given directory, using an IndexWriter using the given matchVersion. 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
    LuceneVersion matchVersion
    TextWriter infoStream
    bool deletePriorCommits

    Methods

    Main(string[])

    Main method to run IndexUpgrader from the command-line.

    LUCENENET specific: In the Java implementation, this Main method was intended to be called from the command line. However, in .NET a method within a DLL can't be directly called from the command line so we provide a .NET tool, lucene-cli, with a command that maps to this method: index upgrade
    Declaration
    public static void Main(string[] args)
    Parameters
    Type Name Description
    string[] args

    The command line arguments

    Exceptions
    Type Condition
    ArgumentException

    Thrown if any incorrect arguments are provided

    ParseArgs(string[])

    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.

    LUCENENET specific: In the Java implementation, this class' Main method was intended to be called from the command line. However, in .NET a method within a DLL can't be directly called from the command line so we provide a .NET tool, lucene-cli, with a command that maps to that method: index upgrade

    Alternatively this class can be instantiated and Upgrade() invoked. It uses UpgradeIndexMergePolicy and triggers the upgrade via an ForceMerge(int) 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 -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 IndexUpgrader(Directory, LuceneVersion, TextWriter, bool).

    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.
    Declaration
    public static IndexUpgrader ParseArgs(string[] args)
    Parameters
    Type Name Description
    string[] args
    Returns
    Type Description
    IndexUpgrader

    Upgrade()

    Perform the upgrade.

    Declaration
    public void Upgrade()
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.