There is a little feature on my blog that I use quite regularly. I have a hidden menu item that displays a list of articles from a particular category. I use it to share content directly with someone by sending them a URL.
The articles aren't linked from anywhere in the visible site navigation. If you don't know the URL, you aren't going to stumble across them by browsing the site. It's a useful way of sharing content without making it part of the normal website experience.
Or so I thought.
It turns out that hiding something from your menu doesn't necessarily hide it from your search results. Who knew? Well, I did. I just forgot.
Joomla's Smart Search does exactly what it is supposed to do. It indexes published content and makes it available when someone searches. It doesn't care whether you've decided that a particular category of articles shouldn't be easily discoverable through your website navigation.
So there I was, happily sharing supposedly hidden content with people, only to discover that anyone using the site's search could potentially find it too.
I don't want to make these articles private by changing their access level. That would mean asking people to log in before they could read them. That rather defeats the purpose of sharing a simple URL with someone.
What I wanted was something much simpler. The articles should remain publicly accessible to anyone who has the URL, but they shouldn't appear in the site's search results.
Fortunately, Joomla already has a solution.
Smart Search filters to the rescue
Smart Search has a feature called Filters. These allow you to control which indexed content is included in a particular set of search results.
Rather than changing permissions, modifying the finder plugin or writing some clever bit of code, I created a new filter.
I called mine Default excluding category XX, replacing XX with the name of the category I wanted to exclude.
The important part was configuring the filter to include everything except the category in question.

Once the filter was created, there was just one more thing to do.
Tell Joomla to use the filter
Creating a filter doesn't automatically mean that every Smart Search page on your site will use it. You need to tell Joomla which filter to apply.
In my case, I wanted the same filter to be used by both the Smart Search menu item and the Smart Search module.
I simply edited each of them and selected my newly created filter.

That's it.
The articles remain published and publicly accessible. Anyone with the direct URL can read them without logging in, but they no longer appear in the site's Smart Search results.
Even better, this isn't a one-time exercise. When I create another article in that category in the future, it will also be excluded by the filter. There is no need to remember to manually remove it from the search index every time I publish something new.
A little less searching, a little more control
This is a good example of why it's worth exploring the features Joomla already provides before reaching for custom code.
I initially considered whether I needed to modify the Smart Search finder plugin to exclude a particular category. That would have worked, but it would also have meant maintaining a code change for something Joomla can already do.
A Smart Search filter was all that was needed.
Of course, this isn't security or privacy. Anyone who knows the URL can still access the articles, and that is precisely the point. I don't want to restrict access; I just don't want the content appearing in the site's search results.
Sometimes you don't want to hide something behind a login, and you don't want it appearing in every search result either. You just want to share a link with someone without the rest of the world being pointed towards it.
And now, thanks to a little-known Smart Search filter, I can.



Congratulations, you discovered a hidden secret!