public void reindexContent ( JcrWorkspace workspace , Path path , int depth ) { if ( getIndexWriter ( ) . canBeSkipped ( ) ) { // There's no indexes that require updating ... return ; } CheckArg . isPositive ( depth , "depth" ) ; JcrSession session = workspace . getSession ( ) ; NodeCache cache = session . cache ( ) . getWorkspace ( ) ; String workspaceName = workspace . getName ( ) ; // Look for the node ... CachedNode node = cache . getNode ( cache . getRootKey ( ) ) ; for ( Segment segment : path ) { // Look for the child by name ... ChildReference ref = node . getChildReferences ( cache ) . getChild ( segment ) ; if ( ref == null ) return ; node = cache . getNode ( ref ) ; } updateIndexesStatus ( workspaceName , IndexManager . IndexStatus . ENABLED , IndexManager . IndexStatus . REINDEXING ) ; // If the node is in the system workspace ... RepositoryCache repoCache = runningState . repositoryCache ( ) ; String systemWorkspaceName = repoCache . getSystemWorkspaceName ( ) ; String systemWorkspaceKey = repoCache . getSystemWorkspaceKey ( ) ; if ( node . getKey ( ) . getWorkspaceKey ( ) . equals ( systemWorkspaceKey ) ) { if ( reindexSystemContent ( node , depth , getIndexWriter ( ) ) ) { commitChanges ( systemWorkspaceName ) ; } } else { // It's just a regular node in the workspace ... if ( reindexContent ( workspaceName , cache , node , depth , path . isRoot ( ) , getIndexWriter ( ) ) ) { commitChanges ( workspaceName ) ; } } updateIndexesStatus ( workspaceName , IndexManager . IndexStatus . REINDEXING , IndexManager . IndexStatus . ENABLED ) ; }
Crawl and index the content starting at the supplied path in the named workspace to the designated depth .