Background
Search has been a feature of Joomla! since its early days. It allows users to search content in the database for words or phrases and return results in first found order. The original form of Search has been replaced by the Smart Search component, which pre-indexes significant words and uses scoring and filtering algorithms to help return the best results. Smart Search is enabled by default in Joomla 4+.
Be Aware
If you have content items that are not available for public view the auto-completion feature will still show terms contained in those content items. The content items themselves cannot be viewed and will not be listed in search results but if revealing the presence of a word or phrase in a restricted content item is of concern then you should disable auto-completion. To disable auto-completion use the following procedure:
- Login to the Administrator interface.
- Select the Smart Search→Index menu item.
- Click the Options button in the upper right.
- On the "Smart Search" tab, change Search Suggestions from Show to Hide.
- Select Save & Close.
Preparing Smart Search plugins
Joomla! includes Smart Search plugins for articles, categories, contacts, news feeds, and tags. Many other components include their own Smart Search plugins as well. For content to be included in search results, it must first be indexed by the enabled Smart Search plugins. Before starting the Indexer (see below), it is recommended that you review the available plugins and disable any that will not be necessary for your site. To review the available Smart Search plugins use the following procedure:
- Login to the Administrator interface.
- Select the System menu item and then click Plugins in the "Manage" group.
- Filter the plugins using the finder item type in the - Select Type - list.
- Review the list of plugins and enable the ones necessary for your site by ensuring the green tick/circle icon shows in the Status column for the plugin. Disabled plugin statuses should show a grey cross/circle.
Running the Indexer
After you have reviewed the search plugins, it is time to start the Smart Search Indexer. This will scan the content on your Website and build an index that will enable fast and intelligent searching by your site visitors. There are two ways to run the Indexer:
- From the Components→Smart Search→Index menu. This is suitable for smaller sites.
- From the Command Line. This is suitable for larger sites and should not incur time-out faults. However, very large sites might really need an external search service.
IMPORTANT NOTE: Smart Search will return no results until you have run the Indexer. If your site's content changes, you'll need to run the Indexer to get that content indexed. How often you do this depends on how precise you want your search results to be and also on how long re-indexing takes.
Index from the Administrator interface
- Login to the Administrator interface.
- Select the Components→Smart Search→Index menu item.
- Select the Index button in the toolbar to run the Indexer. This will cause a modal window to load with some Indexer status information and a progress bar.
Depending on the size of your site, indexing can take a few minutes to a few hours to complete. The Indexer uses AJAX requests to complete the overall process in small chunks to avoid timeouts and memory problems. Indexing is complete when the progress bar disappears and the modal window closes.
Index from the CLI
This method requires access to your site's file system via a terminal (command) shell window.
- Open a terminal window.
- cd to the cli folder in the root of your site.
- Use the following command:
php joomla.php finder:index - When the Indexer has finished go to Components→Smart Search→Content Maps.
Indexed Content
The Content Maps page lists all the indexed content. If you would prefer that specific items not be displayed in search results, you can omit them from the Smart Search results by clicking the green tick/circle or by selecting the checkbox next to the title of the item and then pressing the Unpublish button.
IMPORTANT NOTE: If your site has a large amount of content, or particularly large content items, or has restricted disk space, you should read about Smart Search on large sites.
Exposing Smart Search to Site Users
Now that the Smart Search index is prepared and ready, you need to expose Smart Search to your Website's users. Smart Search offers two ways to do this:
The Module Interface
Smart Search includes a module that can be enabled to display a simple search form on any page in virtually any template position. To enable the Smart Search module use the following procedure:
- Log in to the Administrator interface.
- Select the Content→Site Modules menu item.
- Click the New button in the module manager toolbar.
- Select "Smart Search" from the list of module types shown.
- Configure the module by (at least) entering a title, selecting the module position, and adjusting the pages for it to be displayed if desired. Additional module configuration options are described on the Smart Search module help screen.
- Select the Save button in the toolbar to publish the module.
The Menu Item Interface
Smart Search can also be linked to via a Joomla menu item so that users can navigate directly to the main search form. To create a menu item link to Smart Search use the following procedure:
- Log in to the Administrator interface.
- Select the Menus→Main Menu menu item, for example. Select the applicable menu if it's not Main Menu.
- Press the New button in the menu manager toolbar.
- Click the Select button next to the Menu Item Type field.
- Select "Search" under the "Smart Search" entry on the list of menu item types shown.
- Configure the menu item by (at least) entering a menu Title and adjusting the parent item if desired.
- Click the Save button in the toolbar to publish the menu item.
Search Filters
Search filters can be used to pre-filter searches meant to focus on specific content. These filters can be selected when configuring a Smart Search module or menu item instance; they cannot be selected by site users. To create a new Filter:
- Log in to the Administrator interface.
- Select the Smart Search→Filters menu item.
- Click the New button and give the new filter a name.
- Select the filter criteria for the various taxonomies.
- Click Save and Close to save your new filter.
- Create a new menu or module Smart Search instance and select the filter.
Search Terms
Over time, your site's users will search for a wide variety of terms and phrases. The Search Terms page lists all of the search terms entered and the number of times each one was searched. This gives you a way to know what your users search for the most. To access this page:
- Log in to the Administrator interface.
- Select the Smart Search→Search Terms menu item.
You can clear all the Search Term results by clicking the Reset button at the top of the page.
Plugin Settings
Each Smart Search plugin will likely have settings specific to the component the plugin supports. If you want to limit what your site users can select in terms of taxonomies, you must configure all the plugins in a consistent way to achieve that. The default taxonomies for Joomla!'s default content are as follows. Additionally, you can select whether to search archived content.
- Language
- Country
- Region
- Type (Articles, Categories, Tags)
- Author
- Category
For example, if all your site's articles are written by the same person, you may want to omit Author in all your Smart Search plugins. Similarly, if your site is written entirely in a single language, the omitting Language would make sense. By omitting taxonomies, you limit the choices your site users must select when doing a search.
Testing, Testing, Testing
To test Smart Search, navigate to the menu item you created and enter a query in the search form or enter a query into one of the instances of Smart Search module. You should be taken to a list of search results if any could be found for the word or phrase you entered. If no results could be found, a message will be displayed indicating that no results could be found. If no results could be found and the system has a search suggestion based on your term (if you enabled Search Suggestions in the Smart Search configuration), the suggested search phrase will display above the message indicating no results could be found.