code: public void setIndexRebuildMode(String searchIndex, String mode) {
  
          I_CmsSearchIndex index = OpenCms.getSearchManager().getIndex(searchIndex);
          if (index != null) {
              index.setRebuildMode(mode);
              // required for this setting to take effect
              OpenCms.getSearchManager().initOfflineIndexes();
          }
      }
docs: Sets the rebuild mode for the requested index. Allowing to disable indexing during module import.<p>
  This setting will not be written to the XML configuration file and will only take effect within the current shell instance.<p>
  
  @param searchIndex the search index
  @param mode the rebuild mode to set