code: public void reindex(ItemDataConsumer stateMgr) throws IOException, RepositoryException
     {
        if (stopped.get())
        {
           throw new IllegalStateException("Can't invoke reindexing on closed index.");
        }
  
        if (online.get())
        {
           throw new IllegalStateException("Can't invoke reindexing while index still online.");
        }
  
        // traverse and index workspace
        executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
  
        long count;
  
        // check if we have deal with RDBMS reindexing mechanism
        Reindexable rdbmsReindexableComponent =
           (Reindexable)handler.getContext().getContainer().getComponent(Reindexable.class);
  
        if (handler.isRDBMSReindexing() && rdbmsReindexableComponent != null
           && rdbmsReindexableComponent.isReindexingSupported())
        {
           count =
              createIndex(rdbmsReindexableComponent.getNodeDataIndexingIterator(handler.getReindexingPageSize()),
                 indexingTree.getIndexingRoot());
        }
        else
        {
           count = createIndex(indexingTree.getIndexingRoot(), stateMgr);
        }
  
        executeAndLog(new Commit(getTransactionId()));
        LOG.info("Created initial index for {} nodes", new Long(count));
        releaseMultiReader();
  
     }
docs: Recreates index by reindexing in runtime.
  
  @param stateMgr
  @throws RepositoryException