The search feature is a simple yet necessary feature for any website that has a wide range of content available; often users will have a particular topic or tutorial in mind, and if their searches aren’t leading them in the right direction or, even worse, delivering irrelevant content or links, then their overall site experience is going to take a hefty negative hit.
There’s plenty more reasons to ensure your search is as streamlined as possible, but if you’re working with Joomla then the flexibility is already there for you to take advantage of.
When can filtered searches improve your site?
Sure, the feature’s right there in Joomla, but that doesn’t mean that it’s necessary for your site. However, there are several situations where a more robust search can be a welcome addition. Consider the flexibility of template assignment options that Joomla offers; you can assign different templates to different menu items, creating a site that uses a completely different graphical design depending on which section you’re browsing. Imagine a news site with dedicated sections for each area; one for world news, one for sport, one for technology etc…someone in the world news section won’t want to pull up the latest sport scores when they run a search.
Even smaller websites can benefit; it may not be necessary for all of your website to be discoverable via the search bar, and limiting search results can allow you to pull only from relevant categories. This concept can be applied in other ways too, such as creating search areas in different parts of the website’s interface that apply different rules i.e. a nav bar search can target the specific page for content, whilst a search under a category listing in the sidebar can pull content only from a defined category.
Creating robust searches with the com_finder component
The catalyst of filtered searches in Joomla! is the com_finder component, which is a more extensive and powerful version of the standard Joomla! search engine. With it, the scope of the search engine can be finely tuned with custom filters so that only relevant content is included in any queries. However, it does require additional configuration steps to ensure that it will work correctly.
The first step is to index the site; smart search needs to create an index of your content that it can use to provide fast, accurate search options to your users. We can start this automated process by clicking on Components → Smart Search in the Joomla administrator main menu, which will open the component options on the Manage Indexed Content section, where any content that has been indexed for use by Smart Search will be displayed. Click on the Index button at the top left to start the indexer; you’ll see a popup and a progress bar.
This can take a little while since it’s going to index all your content. Something to be aware of is that this process will fill up several tables in the database with a lot of content, but doing so will allow for more distinct searches and opens up the possibility of creating search filters that can target smart search instances accordingly.
To get started with creating a new smart search filter we’ll need to open the Search Filters tab on the left side of the screen; there won’t be any filters here yet, so click on the New button:
This will open the filter creation page:
Here we have a wealth of options for controlling what elements are included in a search; we can define particular categories, authors, content type and more. Everything is fairly straightforward here; just add a checkmark to any elements you want included in the search. For example, if we want users to be able to search our blog section for relevant articles, we might add checkmarks to the blog categories only so blog searches won’t include our technical documentation in the search, or setup a filter that only checks our help articles or FAQ pages to help users locate the answers they need.
Once the filter is created and saved, it won’t actually be any use until we publish it to the live site via a Smart Search module. This process is the same as any other module; just open the Extensions → Module Manager section of your admin area and create a new module, making sure to select the Smart Search module from the list. The first option in the Smart Search module configuration is Search Filter, where you can select one of your created filters specific to the module:
Once the module is published any searches made using it will have the chosen filter applied to limit the results accordingly.
Search filters are a great solution for create diverse, targeted searches within a single Joomla! website that enhance the customer experience. However, bear in mind that due to the indexing required particularly large websites or those with a limited amount of storage space may encounter additional issues, since indexing will populate a large number of database tables. More information on overcoming these issues, as well as alternative solutions, may be found in the Joomla Documentation.