function apachesolr_index_page in Apache Solr Search 6
Same name and namespace in other branches
- 5.2 apachesolr.admin.inc \apachesolr_index_page()
- 5 apachesolr.module \apachesolr_index_page()
- 6.2 apachesolr.admin.inc \apachesolr_index_page()
Gets information about the fields already in solr index.
1 string reference to 'apachesolr_index_page'
- apachesolr_menu in ./
apachesolr.module - Implementation of hook_menu().
File
- ./
apachesolr.admin.inc, line 133 - Administrative pages for the Apache Solr framework.
Code
function apachesolr_index_page() {
$data = (object) array();
try {
$solr = apachesolr_get_solr();
// TODO: possibly clear this every page view if we are running multi-site.
if (apachesolr_index_updated()) {
$solr
->clearCache();
}
$data = $solr
->getLuke();
} catch (Exception $e) {
watchdog('Apache Solr', nl2br(check_plain($e
->getMessage())), NULL, WATCHDOG_ERROR);
drupal_set_message(nl2br(check_plain($e
->getMessage())), "warning");
$data->fields = array();
}
$output = '';
if (isset($data->index->numDocs)) {
$pending_docs = $delay_msg = $delete_msg = '';
try {
$stats_summary = $solr
->getStatsSummary();
$solr_msg = '<p>' . t('Using schema.xml version: <strong>@schema_version</strong>', $stats_summary);
if ($stats_summary['@core_name']) {
$solr_msg .= '<br />' . t('Solr core name: <strong>@core_name</strong>', $stats_summary);
}
$delay_msg = '<br />' . t('<em>The server has a @autocommit_time delay before updates are processed.</em>', $stats_summary) . "</p>\n";
$delete_msg = '<p>' . t('Number of pending deletions: @deletes_total', $stats_summary) . "</p>\n";
} catch (Exception $e) {
watchdog('Apache Solr', nl2br(check_plain($e
->getMessage())), NULL, WATCHDOG_ERROR);
}
$output .= $solr_msg . $delay_msg;
$pending_msg = $stats_summary['@pending_docs'] ? t('(@pending_docs sent but not yet processed)', $stats_summary) : '';
$output .= '<p>' . t('Number of documents in index: @num !pending', array(
'@num' => $data->index->numDocs,
'!pending' => $pending_msg,
)) . "</p>\n";
$output .= $delete_msg;
}
$output .= '<p>' . l(t('View more details on the search index contents'), 'admin/reports/apachesolr') . "</p>\n";
if (variable_get('apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_WRITE) {
// Display the Delete Index form.
$output .= drupal_get_form('apachesolr_delete_index_form');
}
else {
drupal_set_message(t('The index is in read-only mode. Options for deleting and re-indexing are therefore not available. The index mode can be changed on the !settings_page', array(
'!settings_page' => l(t('settings page'), 'admin/settings/apachesolr'),
)), 'warning');
}
return $output;
}