下面是我用于预处理 apache solr 搜索结果的代码,
function apachesolr_search_apachesolr_process_results(&$results, DrupalSolrQueryInterface $query) {
$rows = array();
foreach ($results as $key => $fields) {
$rows [] = array(
'title' => t($fields['fields']['title']),
'Category' => $fields['fields']['category'],
'Dper' => $fields['fields']['crtor'],
'pvalue' => $fields['fields']['pvalue'],
'rvalue' => $fields['fields']['rvalue'],
'avalue' => $fields['fields']['avalue'],
);
}
$header = array(
array('data' => 'title', 'field' => 'title', 'sort' => 'ASC'),
array('data' => 'category', 'field' => 'category', 'sort' => 'ASC'),
array('data' => 'creator', 'field' => 'creator', 'sort' => 'ASC'),
array('data' => 'pvalue', 'field' => 'pvalue'),
array('data' => 'rvalue', 'field' => 'rvalue'),
array('data' => 'avalue', 'field' => 'avalue'),
);
$results['processresults'] = theme('table', array('header' => $header, 'rows' => $rows));
$results['processresults'] .= theme('pager');
return $results;
}
当我在同一函数中打印 $results['processresults'] 并退出时,表已生成。如果我返回 $results 并且表格没有显示在我的 apache solr 搜索结果页面中。