A combination of three Drupal/Apache Solr modifications to enhance the Drupal/Apache Solr search function.
01. Apachesolr and Drupal 7 – Improving the search for phrases
Source: http://www.almdesigns.co.uk/2013/05/22/apachesolr-drupal-7-improving-search-phrases/
02. Date-boosting Solr / Drupal search results
Source: http://www.metaltoad.com/blog/date-boosting-solr-drupal-search-results
03. Remove search form from search results page
Source: https://drupal.org/node/968002#comment-4573218
Custom module apachesolr_mod.info
name = Apache Solr Search Tuning description = Apache Solr search tuning. dependencies[] = apachesolr dependencies[] = apachesolr_search package = Search Toolkit core = 7.x ; Information added ... 2013-06-04 version = "7.x-1.0" core = "7.x" project = "apachesolr_mod"
Custom module apachesolr_mod.module
<?php /** * Tunes the Apache Solr search function - implements hook_apachesolr_query_alter (). */ function mod_apachesolr_query_alter($query) { $query->replaceParam('pf', 'content^3.0'); $query->addParam('pf', 'label^8.0'); $query->replaceParam('ps', 10); $query->addParam('bf', array('freshness' => 'recip(abs(ms(NOW/HOUR,ds_created)),3.16e-11,1,.1)' )); } /** * Alter the search page output before render - implements hook_page_alter() */ function mod_page_alter(&$page) { // This assumes everything being output in the "content" page region. // Logged in if (!empty($page['content']['system_main']['content']['search_form'])) { unset($page['content']['system_main']['content']['search_form']); } // Not logged in if (!empty($page['content']['system_main']['search_form'])) { unset($page['content']['system_main']['search_form']); } }
Please leave any relevant comments or suggestions for improvement, we all live and learn !!