public class IndexUpdater extends Object
Learn more
The example demonstrates a typical usage of the class.
String sourceIndexFolder = "c:\\MyOldIndex\\";
String targetIndexFolder = "c:\\MyNewIndex\\";
IndexUpdater updater = new IndexUpdater();
if (updater.canUpdateVersion(sourceIndexFolder)) {
int result = updater.updateVersion(sourceIndexFolder, targetIndexFolder);
}
Constructor and Description |
---|
IndexUpdater()
Initializes a new instance of the
IndexUpdater class. |
Modifier and Type | Method and Description |
---|---|
boolean |
canUpdateVersion(String indexPath)
Checks whether an index in the specified directory can be updated to the latest version.
|
boolean |
isLatestVersion(String indexPath)
Checks whether the specified directory contains an index of the latest version.
|
VersionUpdateResult |
updateVersion(String indexPath,
String newIndexPath)
Performs reindexing documents in an index of an old version.
|
public IndexUpdater()
Initializes a new instance of the IndexUpdater
class.
public final boolean isLatestVersion(String indexPath)
Checks whether the specified directory contains an index of the latest version.
indexPath
- The index directory path.true
if the specified directory contains an index of the latest version;
otherwise false
.public final boolean canUpdateVersion(String indexPath)
Checks whether an index in the specified directory can be updated to the latest version.
indexPath
- The index directory path.true
if an index in the specified directory can be updated to the latest version; otherwise false
.public final VersionUpdateResult updateVersion(String indexPath, String newIndexPath)
Performs reindexing documents in an index of an old version.
The updated index will be placed in the newIndexPath
directory.
The index in the indexPath
directory will not be changed.
indexPath
- The index directory path.newIndexPath
- The directory for the updated index.