Stop Searching

Photo of Greg Harvey
Wed, 2008-07-09 12:19By greg

There are times when you don't want people to search for specific content types. For example, you may not want to be obliged to theme a content type which is not supposed to be visible anyway, just in case it surfaces in a search. Or there may be a content type which you specifically do *not* want people to be able to search on.

There are two ways to skin this cat, that I know of at least:

1) Use hook_db_rewrite_sql to intercept the query and drop your unwanted content types from the search. I won't re-invent the wheel. Jeff Eaton at Lullabot has already written a nice "HOW TO"-style blog about it here:

2) Use the Search Config module to manage the search indexes and drop content you don't want people to search on from the index (as well as unsetting the unwanted Advanced Search checkboxes, of course):

There are cases where option 1) might be preferable, but not many.

If anyone knows of other/better ways, do comment! =)