code: protected void updateIndex(I_CmsSearchIndex index, I_CmsReport report, List<CmsPublishedResource> resourcesToIndex)
      throws CmsException {
  
          if (shouldUpdateAtAll(index)) {
              try {
                  SEARCH_MANAGER_LOCK.lock();
  
                  // copy the stored admin context for the indexing
                  CmsObject cms = OpenCms.initCmsObject(m_adminCms);
                  // make sure a report is available
                  if (report == null) {
                      report = new CmsLogReport(cms.getRequestContext().getLocale(), CmsSearchManager.class);
                  }
  
                  // check if the index has been configured correctly
                  if (!index.checkConfiguration(cms)) {
                      // the index is disabled
                      return;
                  }
  
                  // set site root and project for this index
                  cms.getRequestContext().setSiteRoot("/");
                  // switch to the index project
                  cms.getRequestContext().setCurrentProject(cms.readProject(index.getProject()));
  
                  if ((resourcesToIndex == null) || resourcesToIndex.isEmpty()) {
                      // rebuild the complete index
  
                      updateIndexCompletely(cms, index, report);
                  } else {
                      updateIndexIncremental(cms, index, report, resourcesToIndex);
                  }
              } finally {
                  SEARCH_MANAGER_LOCK.unlock();
              }
          }
      }
docs: Updates (if required creates) the index with the given name.<p>
  
  If the optional List of <code>{@link CmsPublishedResource}</code> instances is provided, the index will be
  incrementally updated for these resources only. If this List is <code>null</code> or empty,
  the index will be fully rebuild.<p>
  
  @param index the index to update or rebuild
  @param report the report to write output messages to
  @param resourcesToIndex an (optional) list of <code>{@link CmsPublishedResource}</code> objects to update in the index
  
  @throws CmsException if something goes wrong