Index: apachesolr.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.admin.inc,v
retrieving revision 1.1.2.28.2.36
diff -u -p -r1.1.2.28.2.36 apachesolr.admin.inc
--- apachesolr.admin.inc	3 May 2010 18:50:27 -0000	1.1.2.28.2.36
+++ apachesolr.admin.inc	23 Jul 2010 06:08:28 -0000
@@ -106,6 +106,23 @@ function apachesolr_settings() {
     '#options' => array(APACHESOLR_READ_WRITE => t('Read and write (normal)'), APACHESOLR_READ_ONLY => t('Read only')),
     '#description' => t('<em>Read only</em> stops this site from sending updates to your search index. Useful for development sites.'),
   );
+
+  // Get the list of requestHandlers that are both in solrconfig.xml
+  // and in statistics response from Solr.
+  $solrconfig_handlers = apachesolr_solrconfig_requesthandlers();
+  $solr_handlers = apachesolr_solr_requesthandlers();
+  $handlers_options = array_intersect($solrconfig_handlers, $solr_handlers);
+
+  if (($handlers_options) && (count($handlers_options) > 1)) {
+    $form['advanced']['apachesolr_handler'] = array(
+      '#type' => 'radios',
+      '#title' => t('Request Handler'),
+      '#options' => $handlers_options,
+      '#default_value' => variable_get('apachesolr_handler', 'dismax'),
+      '#description' => t('Choose what Request Handler you would like to be used on queries to Solr. !info_link.', array('!info_link' => l('Read more about handlers', 'http://wiki.apache.org/solr/SolrRequestHandler'))),
+    );
+  }
+
   return system_settings_form($form);
 }
 
Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.155.2.102
diff -u -p -r1.1.2.12.2.155.2.102 apachesolr.module
--- apachesolr.module	22 Jul 2010 02:57:29 -0000	1.1.2.12.2.155.2.102
+++ apachesolr.module	23 Jul 2010 06:08:29 -0000
@@ -2225,6 +2225,67 @@ function theme_apachesolr_sort_list($ite
 }
 
 /**
+ * Parse solrconfig.xml to get list of requestHandlers.
+ *
+ * @return array
+ *  Array of handler names or FALSE on error.
+ */
+function apachesolr_solrconfig_requesthandlers() {
+  $solrconfig = simplexml_load_file(drupal_get_path('module', 'apachesolr') . '/solrconfig.xml');
+
+  if (!$solrconfig) {
+    return FALSE;
+  }
+
+  $handlers_xml = $solrconfig->xpath('//requestHandler');
+  $handlers = array();
+  foreach ($handlers_xml as $handler_xml) {
+    $attributes = $handler_xml->attributes();
+    $handler_name = (string)$attributes['name'];
+    $handlers[$handler_name] = $handler_name;
+  }
+
+  return $handlers;
+}
+
+/**
+ * Retrieve list of requestHandlers from Solr.
+ *
+ * @return array
+ *  Array of handler names or FALSE on error.
+ */
+function apachesolr_solr_requesthandlers() {
+  // Check if solr is connected.
+  $solr = array();
+  try {
+    $solr = apachesolr_get_solr();
+    // TODO: possibly clear this every page view if we are running multi-site.
+    if (apachesolr_index_get_last_updated()) {
+      $solr->clearCache();
+    }
+  }
+  catch (Exception $e) {
+    watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
+    drupal_set_message(nl2br(check_plain($e->getMessage())), "warning");
+  }
+
+  if (empty($solr)) {
+    return FALSE;
+  }
+
+  // Parse stats XML to get all handlers.
+  $stats = $solr->getStats();
+  $handlers_xml = $stats->xpath('//QUERYHANDLER/entry/name');
+  $handlers = array();
+  foreach ($handlers_xml as $handler_xml) {
+    $handler_name = trim(current($handler_xml));
+    $handlers[$handler_name] = $handler_name;
+  }
+
+  return $handlers;
+}
+
+/**
  * The interface for all 'query' objects.
  */
 interface Drupal_Solr_Query_Interface {
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.111.2.82
diff -u -p -r1.1.2.6.2.111.2.82 apachesolr_search.module
--- apachesolr_search.module	22 Jul 2010 04:30:27 -0000	1.1.2.6.2.111.2.82
+++ apachesolr_search.module	23 Jul 2010 06:08:30 -0000
@@ -367,7 +367,8 @@ function apachesolr_search_basic_params(
     'rows' => variable_get('apachesolr_rows', 10),
     'facet' => 'true',
     'facet.mincount' => 1,
-    'facet.sort' => 'true'
+    'facet.sort' => 'true',
+    'qt' => variable_get('apachesolr_handler', 'dismax'),
   );
   return $params;
 }
