You are here

function apachesolr_search_help in Apache Solr Search 6

Same name and namespace in other branches
  1. 5.2 apachesolr_search.module \apachesolr_search_help()
  2. 6.2 apachesolr_search.module \apachesolr_search_help()

Implementation of hook_help().

File

./apachesolr_search.module, line 12
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_help($section) {
  switch ($section) {
    case 'admin/settings/apachesolr/index':
      if (variable_get('apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
        return t('Operating in read-only mode; updates are disabled.');
      }
      $remaining = 0;
      $total = 0;

      // Collect the stats
      $status = apachesolr_index_status('apachesolr_search');
      $remaining += $status['remaining'];
      $total += $status['total'];
      return t('The search index is generated by !cron. %percentage of the site content has been sent to the server. There @items left to send.', array(
        '!cron' => l(t('running cron'), 'admin/reports/status/run-cron', array(
          'query' => 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')),
      ));
  }
}