IndexUpdater class

IndexUpdater class

Represents an index updater.

The IndexUpdater type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the IndexUpdater class.

Methods

Method Description
can_update_version Checks whether an index in the specified directory can be updated to the latest version.
is_latest_version Checks whether the specified directory contains an index of the latest version.
update_version Updates an index of an old version to the latest version.

Example

from groupdocs.search import Index, IndexUpdater
from groupdocs.search.common import VersionUpdateResult

source = "./old_index"
target = "./new_index"

updater = IndexUpdater()
if updater.can_update_version(source):
    result = updater.update_version(source, target)
    if result == VersionUpdateResult.UPDATED:
        index = Index(target)
        print(f"Updated index contains {len(index.get_indexed_documents())} documents")

See Also