Index: apachesolr.taxonomy.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.taxonomy.inc,v retrieving revision 1.1.2.2.2.1 diff -u -r1.1.2.2.2.1 apachesolr.taxonomy.inc --- apachesolr.taxonomy.inc 24 Jul 2009 22:20:58 -0000 1.1.2.2.2.1 +++ apachesolr.taxonomy.inc 28 Aug 2009 17:06:42 -0000 @@ -41,7 +41,9 @@ try { //stolen from search.module (search_data) - $data = apachesolr_search_execute($keys, $filters, $solrsort, 'search/apachesolr_search', $page); + $data = apachesolr_search_execute($keys, $filters, $solrsort, + 'search/'. variable_get('apachesolr_search_prefix', 'apachesolr_search'), $page); + $results = theme('search_results', $data, $type); } catch (Exception $e){ watchdog('apachesolr', t('Error running search')); 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.10 diff -u -r1.1.2.6.2.111.2.10 apachesolr_search.module --- apachesolr_search.module 27 Aug 2009 20:07:02 -0000 1.1.2.6.2.111.2.10 +++ apachesolr_search.module 28 Aug 2009 17:37:31 -0000 @@ -77,6 +77,11 @@ $menu['search/apachesolr_search/%menu_tail']['title'] = 'Content'; } } + + // this is probably not the best approach + $menu['search/' . variable_get('apachesolr_search_prefix', 'apachesolr_search') . '/%menu_tail'] = $menu['search/apachesolr_search/%menu_tail']; + unset ($menu['search/apachesolr_search/%menu_tail']); + if (variable_get('apachesolr_search_taxonomy_links', 0)) { if (isset($menu['taxonomy/term/%'])) { $menu['taxonomy/term/%']['page callback'] = 'apachesolr_search_taxonomy_term_page'; @@ -126,7 +131,9 @@ $solrsort = isset($_GET['solrsort']) ? $_GET['solrsort'] : ''; $page = isset($_GET['page']) ? $_GET['page'] : 0; try { - $results = apachesolr_search_execute($keys, $filters, $solrsort, 'search/' . arg(1), $page); + $results = apachesolr_search_execute($keys, $filters, $solrsort, + 'search/' . variable_get('apachesolr_search_prefix', 'apachesolr_search'), $page); + return $results; } catch (Exception $e) { @@ -148,11 +155,11 @@ // Note: search/X can not be a default tab because it would take on the // path of its parent (search). It would prevent remembering keywords when // switching tabs. This is why we drupal_goto to it from the parent instead. - drupal_goto('search/apachesolr_search'); + drupal_goto('search/'. variable_get('apachesolr_search_prefix', 'apachesolr_search')); } $keys = trim(search_get_keys()); $filters = ''; - if ($type == 'apachesolr_search' && isset($_GET['filters'])) { + if ($type == variable_get('apachesolr_search_prefix', 'apachesolr_search') && isset($_GET['filters'])) { $filters = trim($_GET['filters']); } // Only perform search if there is non-whitespace search term or filters: @@ -165,6 +172,9 @@ watchdog('search', '%keys (@type).', array('%keys' => $log, '@type' => t('Search')), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys)); // Collect the search results: + if ($type == variable_get('apachesolr_search_prefix', 'apachesolr_search')) { + $type = 'apachesolr_search'; + } $content = search_data($keys, $type); if ($content) { @@ -850,7 +860,8 @@ if (variable_get('clean_url', '0')) { $keys = str_replace('+', '%2B', $keys); } - $form_state['redirect'] = 'search/apachesolr_search/'. trim($keys); + $form_state['redirect'] = 'search/'. variable_get('apachesolr_search_prefix', 'apachesolr_search') .'/'. trim($keys); + } /** @@ -922,7 +933,8 @@ function apachesolr_search_form_search_submit($form, &$form_state) { $fv = $form_state['values']; $keys = $fv['processed_keys']; - $base = 'search/'. $fv['module'] . '/'; + $base = 'search/'. variable_get('apachesolr_search_prefix', 'apachesolr_search') . '/'; + if (variable_get('clean_url', '0')) { $keys = str_replace('+', '%2B', $keys); } @@ -952,6 +964,22 @@ '#options' => array(0 => t('Disabled'), 1 => t('Enabled')), '#description' => t('Hides core node search, and makes the search block submit to Apache Solr Search'), ); + + $form['advanced']['apachesolr_search_prefix_previous'] = array( + '#type' => 'value', + '#value' => variable_get('apachesolr_search_prefix_previous', 'apachesolr_search'), + ); + $form['advanced']['apachesolr_search_prefix'] = array( + '#type' => 'textfield', + '#title' => t('Prefix to use when conducting searches'), + '#default_value' => variable_get('apachesolr_search_prefix', 'apachesolr_search'), + '#size' => 30, + '#maxlength' => 60, + '#required' => TRUE, + '#description' => t('Changes the url when Apache Solr replaces default search ie: search/%path/terms', + array('%path' => variable_get('apachesolr_search_prefix', 'apachesolr_search'))), + ); + $form['advanced']['apachesolr_search_default_previous'] = array( '#type' => 'value', '#value' => variable_get('apachesolr_search_make_default', 0), @@ -991,6 +1019,7 @@ function apachesolr_search_make_default_submit($form, &$form_state) { // We use variable_get() instead of the form values so as to also handle reset to defaults. if ($form_state['values']['apachesolr_search_default_previous'] != variable_get('apachesolr_search_make_default', 0) || + $form_state['values']['apachesolr_search_prefix_previous'] != variable_get('apachesolr_search_prefix', 'apachesolr_search') || $form_state['values']['apachesolr_search_taxonomy_previous'] != variable_get('apachesolr_search_make_default', 0)) { // Take account of path changes menu_rebuild();