Thursday, Aug 12th, 2010

There are two ways to rename the sorting methods available in the Drupal 6 Apache Solr module. First is the simpler method of changing the translation of the sort title as it is passed through t(). Second is changing the available sorts in the query object in a custom module. If you need to re-order, changing the query object is your only option. The default available sorts are listed in Solr_Base_Query.php:

/**
* Returns a default list of sorts.
*/
protected function default_sorts() {
// The array keys must always be real Solr index fields.

Thursday, Aug 12th, 2010

By default the Drupal ApacheSolr module does not display the total number of results for a given search. This is how to add it.

For my use it makes sense to add the result total to the Search form using hook_form_[form_id]_alter().


/**
* Implementation of hook_form_[form_id]_alter().
*/
function ms_solr_site_form_search_form_alter(&$form, &$form_state) {
if ($form['module']['#value'] == 'apachesolr_search') { //Will change all searches otherwise.
if (apachesolr_has_searched() && ($response = apachesolr_static_response_cache())) {

Pages

Subscribe to Front page feed