Dear Chapter Three,
I'm in Drupal 7 and have Apache Solr running on my Pantheon site and we need to customize the layout of the search results page. We've been using Panels for every other page, so we'd really like to use Panels here as well. We noticed that there is an existing panel page template titled: "search-apachesolr_search", but when we enable it our searches always return no results. What's the deal?
Thanks for writing Rikki. Unfortunately the "search-apachesolr_search" panel template seems to be broken and won't work for you. Fortunately for us there's a great module called Apache Solr Panel which is exactly what you need. Here's some pseudo-code to get you started:
- Install the best release for apachesolr_panels module.
- If you get the errors we saw, apply the patch. (Hopefully this will be rolled into a new release soon. Currently 7.x-1.0 does not include this patch.)
- Create a new custom panel page following the instructions in the apachesolr_panels readme:
- Create a new custom panel page.
- Make the URL: some-search-url-you-want/!query
- When prompted, make the argument in the url = 'string' and give it the name 'search query'.
- Fill out all other forms as usual.
- When asked to add panel panes, add in the search and results ones in the Apache Solr Panels fieldset.
- It may ask what context - tell it the query you created ('search query' if you followed the directions above).
But what about the search block? If you try it now, it's pointing to the old search page - not the custom panel page you just created. The Apache Solr Panels module has you covered there as well.
- If you're using the search block in a region:
- Remove the search block and use the apachesolr search block instead.
- It will ask you what the url is for your custom search page and you will say whatever you called it above. (For our example, you'd put: 'some-search-url-you-want').
- If you're using a search box provided by the theme (in a tpl.php):
- You will have to do a hook_form_alter on the form to change the url.
Good luck! Let us know if you have any more questions.