Custom Search Path
| Project: | Apache Solr Search Integration |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
I'm looking for suggestions on the best way to modify the search path from search/apachesolr_search/% to something more appealing to business editors. #327833: Allow Override of Core Search Path - /search was a similar request to what I'm trying to do but was marked as a duplicate of #337737: Re-Work get_path() so that the facet blocks can be used outside the search page. Rather than just allowing the blocks to work from any context I'd like to be able to have everything point to search/% or myterm/% instead of search/apachesolr_search/%
I've tried a few different options for doing this and can take them further but wanted to post here in case there is an easier approach that I am missing.

#1
I didn't find a better option so here's first attempt at a patch. It adds a new variable in the Advanced Configuration area that optionally replaces 'apachesolr_search' in paths with search/apachesolr_search/term when apachsolr replaces default search.
#2
#3
Here is same patch re-rolled for 6.x-1.x-dev
#4
+++ apachesolr.taxonomy.inc (working copy)@@ -41,7 +41,10 @@
+ $data = apachesolr_search_execute($keys, $filters, $solrsort,
+ 'search'. variable_get('apachesolr_search_prefix', 'apachesolr_search'), $page);
Missed a / in 'search/'
I also added the appropriate lines to enforce a menu_rebuild() upon changing this setting.
The browse-by blocks and ability to search without keys stopped working; fixed with this: (a big fat hack?):
--- 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
@@ -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);
Maybe we need to put our efforts behind decoupling from core search to do this. You call, @robert..
New patch, please review.
#5
Just an FYI that we just accomplished this by exposing everything to panel pages. Now we just create panels wherever we want search results.
#6
whoops, meant to reply to cyberswat...
#7
I don't suppose you would be interested in going into some detail? I don't understand, what do panel pages have to do with whether you can tell Drupal that /search now means, "use apachesolr_search and return results, but keep the url like this: http://mywebsite/search".
#8
nevermind, i figured something out.