Experience with search logging using the zeitgeist module on various sites I maintain in the last 12 months have been showing a fairly constant behaviour: empty searches tend to outnumber the most often used non-empty search by a 10 to 20-to-1 ratio.
Currently, such empty searches bring the user to the general search page, and it seems that for many sites, this may not be optimal, because it loses them an important occasion to lead users where the web master feels best to lead them.
Of course, this search page can be modified as needed via theming (in D5, no such mention for D6), but it seems it would be a neat idea for non-developers to allow empty searches to be directed to a specific page via a simple setting on search module, like "Redirect empty searches to: (textfield), defaulting to front page)".
Comments
Comment #1
robertdouglass commentedWhen you say empty searches, do you mean users searching for an empty string, or searches that don't return any results?
Renaming to reflect feature request.
Comment #2
fgmI mean searches for an empty string. Searches returning nothing are actually searches so it makes sense to return the normal search page and offer the user another chance to search. Empty search criteria, however, can mean either a crawler at work (in which case redirecting to a TOC is useful), or a lost user who doesn't even know what to actually search (in which case redirection to a specially crafted is useful too).
This being said, allowing for a simpler injection methods for admins to insert additional help on search results returning no results would be useful too, but these are two distinct needs.
Comment #3
fgmadjusting topic
Comment #4
elgreg commentedsubscribing - would like to see the ability for a user to run a blank search on a content type to find all hits of that content type.
Comment #5
douggreen commentedThis is closely related, if not a duplicate of #115540: "no results" page not themeable, and they should be worked together.
Comment #6
jhodgdonNot really the same. "no results" is when the search is for a keyword that has no match. This is asking specifically to make a search when someone doesn't enter keywords go to a different page.
Anyway, this didn't make it into Drupal 7, so moving to Drupal 8 idea queue.
Comment #7
jhodgdonThis issue keeps getting misunderstood (by me again today), so updating the title
Comment #8
jhodgdonClarifying that this has to do with the search block -- the request is that if the search block is used, and no keywords are entered, that the site be able to do something different than going to the search results page.
The way that the search block works now in 8.x is that it is a GET form whose action URL is the default search page... so there is really no way to customize this in Core in the way that is being asked for.
However, you could do one of the following, in either 7.x or 8.x:
a) Use hook_form_alter() or one of the more specific variants to alter the form, and thereby change what happens when it is submitted.
b) Since this only applies to the block, you could (instead of using the Core search block on your site) make your own block in a module that, when the form is submitted, would do whatever you want it to.
So, I think this is a support request, because the ability to alter the form or create your own block exists in Core, and there really isn't a better way to change this behavior that we could/would build into Core. Good luck!