docs: protected void reindexIfNeeded( boolean async, final boolean includeSystemContent ) {
          final ScanningRequest request = toBeScanned.drain();
          if (!request.isEmpty()) {
              final RepositoryCache repoCache = runningState.repositoryCache();
              scan(async, () -> {
                  // Scan each of the workspace-path pairs ...
                  ScanOperation op = (workspaceName, path, writer) -> {
                      NodeCache workspaceCache = repoCache.getWorkspaceCache(workspaceName);
                      if (workspaceCache != null) {
                          // The workspace is still valid ...
                          CachedNode node = workspaceCache.getNode(workspaceCache.getRootKey());
                          if (!path.isRoot()) {
                              for (Segment segment : path) {
                                  ChildReference child = node.getChildReferences(workspaceCache).getChild(segment);
                                  if (child == null) {
                                      // The child no longer exists, so ignore this pair ...
                                      node = null;
                                      break;
                                  }
                                  node = workspaceCache.getNode(child);
                                  if (node == null) break;
                              }
                          }
                          if (node != null) {
                              if (logger.isDebugEnabled()) {
                                  logger.debug("Performing full reindexing for repository '{0}' and workspace '{1}'", 
                                               repoCache.getName(),
                                               workspaceName);
                              }
                              // If we find a node to start at, then scan the content ...
                              // in certain cases (e.g. at startup) we have to index the system content (if it applies to
                              // any of the indexes)
                              boolean scanSystemContent = includeSystemContent ||
                                                          repoCache.getSystemWorkspaceName().equals(workspaceName);
                              updateIndexesStatus(workspaceName, IndexManager.IndexStatus.ENABLED, IndexManager.IndexStatus.REINDEXING);
                              if (reindexContent(workspaceName, workspaceCache, node, Integer.MAX_VALUE, scanSystemContent, 
                                                 writer)) {
                                  commitChanges(workspaceName);
                              }
                              updateIndexesStatus(workspaceName, IndexManager.IndexStatus.REINDEXING, IndexManager.IndexStatus.ENABLED);
                          }
                      }
                  };
                  request.onEachPathInWorkspace(op);
                  return null;
              });
          }
      }