com.groupdocs.search

Class IndexUpdater



  • public class IndexUpdater
    extends Object
    Represents an index updater. This class performs reindexing documents in an index of an old version.

    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 Detail

      • IndexUpdater

        public IndexUpdater()

        Initializes a new instance of the IndexUpdater class.

    • Method Detail

      • isLatestVersion

        public final boolean isLatestVersion(String indexPath)

        Checks whether the specified directory contains an index of the latest version.

        Parameters:
        indexPath - The index directory path.
        Returns:
        true if the specified directory contains an index of the latest version; otherwise false.
      • canUpdateVersion

        public final boolean canUpdateVersion(String indexPath)

        Checks whether an index in the specified directory can be updated to the latest version.

        Parameters:
        indexPath - The index directory path.
        Returns:
        true if an index in the specified directory can be updated to the latest version; otherwise false.
      • updateVersion

        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.

        Parameters:
        indexPath - The index directory path.
        newIndexPath - The directory for the updated index.
        Returns:
        The result of the index version update operation.