Index: apachesolr.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.admin.inc,v
retrieving revision 1.1.2.24
diff -u -r1.1.2.24 apachesolr.admin.inc
--- apachesolr.admin.inc	18 Jun 2009 08:01:15 -0000	1.1.2.24
+++ apachesolr.admin.inc	19 Jun 2009 10:13:14 -0000
@@ -86,6 +86,13 @@
     '#default_value' => variable_get('apachesolr_read_only', 0),
     '#options' => array(0 => t('Both update and search (normal)'), 1 => t('Only search (read-only)')),
   );
+  $form['advanced']['apachesolr_serve_taxonomy_links'] = array(
+    '#type' => 'radios',
+    '#title' => t('Use Apache Solr for taxonomy links'),
+    '#default_value' => variable_get('apachesolr_serve_taxonomy_links', 0),
+    '#description' => t('Note: Vocabularies that need this behavior need to be checked off on the <a href="@enabled_filters_url">enabled filters</a> settings page', array('@enabled_filters_url' => url('settings/apachesolr/enabled-filters'))),
+    '#options' => array(0 => t('Yes'), 1 => t('No')),
+  );
   return system_settings_form($form);
 }
 
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.103
diff -u -r1.1.2.6.2.103 apachesolr_search.module
--- apachesolr_search.module	18 Jun 2009 18:32:36 -0000	1.1.2.6.2.103
+++ apachesolr_search.module	19 Jun 2009 10:13:15 -0000
@@ -1,6 +1,8 @@
 <?php
 // $Id: apachesolr_search.module,v 1.1.2.6.2.103 2009/06/18 18:32:36 pwolanin Exp $
 
+include_once(drupal_get_path('module', 'apachesolr') .'/apachesolr.taxonomy.inc');
+
 /**
  * @file
  *   Provides a content search implementation for node content for use with the
@@ -80,6 +82,12 @@
       $menu['search']['page arguments'] = array('apachesolr_search');
     }
   }
+  if (variable_get('apachesolr_serve_taxonomy_links', 0)) {
+    if (isset($menu['taxonomy/term/%'])) {
+      $menu['taxonomy/term/%']['page callback'] = 'apachesolr_override_taxonomy_term_page';
+      unset($menu['taxonomy/term/%']['file']);
+    }
+  }
 }
 
 /**
Index: apachesolr.taxonomy.inc
===================================================================
RCS file: apachesolr.taxonomy.inc
diff -N apachesolr.taxonomy.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ apachesolr.taxonomy.inc	19 Jun 2009 10:13:15 -0000
@@ -0,0 +1,69 @@
+<?php
+// $Id$
+
+/**
+ * Overrides taxonomy/term/X links
+ */
+function apachesolr_taxonomy_override_taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
+  static $vids_to_override; 
+  if (!isset($vids_to_override)) {
+    $vids_to_override = apachesolr_get_enabled_facets('apachesolr_search');
+  }
+  
+  $terms = taxonomy_terms_parse_string($str_tids);
+  $redirect_to_apachesolr = TRUE;
+  
+  // Only support one term, only page callbacks, and only depth = 0 (because of way Solr indexing works)
+  if ( (sizeof($terms['tids']) > 1 && $terms['operator'] != 'and') || ($op != 'page') || ($depth != 0) ) {
+    $redirect_to_apachesolr = FALSE;
+  }
+  else {
+    // Check if term belongs to vocabulary selected by admin as an available filter
+    $term = taxonomy_get_term($terms['tids'][0]);
+    $vocabulary_facet_name = 'im_vid_' . $term->vid;
+    
+    if (!in_array($vocabulary_facet_name, $vids_to_override)) {
+      $redirect_to_apachesolr = FALSE;
+    }
+  }
+
+  if ($redirect_to_apachesolr == FALSE) {
+    // Fallback to normal taxonomy/term page
+    require_once("modules/taxonomy/taxonomy.pages.inc");
+    return taxonomy_term_page($str_tids, $depth, $op);  
+  }
+  else {
+    $keys = "";
+    $filters = 'tid:' . implode(' tid:', $terms['tids']);
+    $solrsort = isset($_GET['solrsort']) ? $_GET['solrsort'] : '';
+    $page = isset($_GET['page']) ? $_GET['page'] : 0;
+    
+    try {
+      //stolen from search.module (search_data)
+      $results = apachesolr_search_execute($keys, $filters, $solrsort, 'search/apachesolr_search', $page);
+      if (module_hook('apachesolr_search', 'search_page')) {
+        $results = module_invoke('apachesolr_search', 'search_page', $results);
+      }
+      else {
+        $results = theme('search_results', $results, $type);
+      }
+    } catch (Exception $e){
+      watchdog('apachesolr', t('Error running search'));
+    }
+    
+    //Set the title to the term name like taxonomy does.
+    drupal_set_title(check_plain($term->name));
+    
+    if ($results) {
+      $results = theme('box', t('Results within @term', array('@term' => $term->name)), $results);
+    }
+    else {
+      $results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
+    } 
+    
+    //this sucks, but I don't know how we can add the retain filters box without using a global of some sort :(
+    $_REQUEST['filters'] = $filters;
+    $_GET['retain-filters'] = TRUE;
+    return drupal_get_form('search_form', NULL, "", "apachesolr_search") . $results;
+  }
+}
