You are here

function apachesolr_help in Apache Solr Search 5

Implementation of hook_help().

File

./apachesolr.module, line 46
Integration with the Apache Solr search application.

Code

function apachesolr_help($section) {
  switch ($section) {
    case 'admin/settings/apachesolr/index':

      // Collect some stats (from search.module)
      $remaining = 0;
      $total = 0;
      foreach (module_list() as $module) {
        if (module_hook($module, 'search')) {
          $status = module_invoke($module, 'search', 'status');
          $remaining += $status['remaining'];
          $total += $status['total'];
        }
      }
      return t('Apache Solr search index is generated by !cron. %percentage of the site has been indexed. There @items left to index.', array(
        '!cron' => l(t('running cron'), 'admin/logs/status/run-cron', array(), 'destination=admin/settings/apachesolr/index'),
        '%percentage' => (int) min(100, 100 * ($total - $remaining) / max(1, $total)) . '%',
        '@items' => format_plural($remaining, t('is 1 item'), t('are @count items')),
      ));
  }
}