• About us
    • Joomla Home
    • What is Joomla?
    • Benefits & Features
    • Project & Leadership
    • Trademark & Licensing
    • The Joomla Foundation
    • Support us
    • Contribute
    • Sponsor
    • Partner
    • Shop
    • Downloads
    • Extensions
    • Languages
    • Get a free site
    • Get a domain
    • Documentation
    • Training
    • Certification
    • Site Showcase
    • Announcements
    • Blogs
    • Magazine
    • Community Portal
    • Events
    • User Groups
    • Forum
    • Service Providers Directory
    • Volunteers Portal
    • Vulnerable Extensions List
    • Developer Network
    • Security Centre
    • Issue Tracker
    • GitHub
    • API Documentation
    • Joomla! Framework

Joomla!

Download
Launch
  • Joomla Documentation
  • User Manual
  • Jobs To Do
  • Contributors
  • Re-structure
  • Getting Started
    • Introduction to Joomla!
    • Joomla Core Features
    • Hosting Setup
    • Installing Joomla
    • Logging in to Joomla
    • Articles and categories
    • Adding a Category
    • Adding an Article
    • Adding a Menu Item
    • Adding a Module
    • Keyboard Shortcuts

Smart Search

Smart Search FAQs

Why Should I Use Smart Search?

Search technology has improved considerably over the years since Joomla was first launched and yet the standard, basic search component has not changed much over that time. It is still very crude and lacks the kind of search features that web users have come to expect, especially given the prevalence of advanced search engines such as Google. Smart Search allows you to incorporate some of those more advanced search features into your website.

Why Create a Smart Search Plugin?

Generally, if you have a type of content that is not handled by the core Joomla components, and you want to give your site visitors the opportunity to search that content, you will need to write a Smart Search Plugin to support it. For example, suppose you have a component that stores information about different animal species. The component maintains a database table containing fields such as scientific name, vernacular name, classification and a description. Then you will need to create a Plugin that will tell the Smart Search indexer how to index the data in that table. As well as indexing individual words and phrases, you can also have the Plugin add each record to a content map, which might in this case include the kingdom, phylum, class, order and family biological classifications. Content maps can then be used to filter search results.

Can Multiple Nodes Be Selected From the Filter Drop-downs?

Yes, this is fully supported by Smart Search itself. Indeed, you can use whatever user interface you care to devise for the filters. Just take a look at the code provided in the standard Frontend module and component and you will see how you need to do it.

I Have a Large Site. Can I Use Smart Search?

Large sites may be better off with a dedicated standalone search engine, such as Solr, rather than the pure-PHP implementation used in Smart Search. In this first iteration of advanced search in Joomla it is likely that issues relating to scaling and performance will be revealed. There is also the potential for race conditions to occur when updating the index on frequent content changes. These issues are expected to be addressed more fully in a future version of Joomla.

Why Does Smart Search Have So Many Tables?

Smart Search adds quite a few new tables to a Joomla installation, including 16 "mapping tables". These mapping tables resolve the many-to-many relationship between search terms and the content items that contain them. In theory those 16 tables could be merged into a single table and doing so would have negligible impact on small sites. However, on larger sites there would be a substantial impact on performance because the mapping table would have a very large number of entries and updating such a large table can be time-consuming.

Why Does Smart Search Use So Much Disk Space?

Maintaining a search term index requires a fair amount of disk space, which increases the more terms that content items contain. Since phrases are also indexed, the longer the phrases, the more disk space required. For Smart Search in Joomla 2.5 the maximum length of a phrase has been fixed at 3 terms as a reasonable compromise between search usability and disk space usage. It is likely that this will be a parameter that can be tuned in a future version of Smart Search.

Why Are the Entries in the Mapping Tables Not Uniformly Distributed?

It is perhaps surprising that the number of entries in each of the mapping tables is not even roughly the same. Surely performance would be improved with uniform distribution? Actually no, there is a trade-off between insertion performance and search performance with a uniform distribution being good for the former but poor for the latter. This is an area of continuing research with the number of tables and the distribution algorithm subject to change in the light of experience.

Why is There a Separate Smart Search Content - Plugin?

This is just a convenience that makes it easier to enable or disable all the Smart Search Plugins with a single operation. This was considered desirable because Smart Search is not enabled by default in Joomla 2.5.

Why Do Smart Search Plugins Use Separate Events such as onFinderContentAfterSave?

Smart Search uses its own events, such as onFinderContentAfterSave, rather than the generic equivalent onContentAfterSave, purely as a convenience to make it easy to enable or disable Smart Search indexing by enabling/disabling a single Plugin.

Why is Smart Search Not Enabled by Default in Joomla 2.5 and Joomla 3.x?

Because Joomla 2.5 is the last in the 1.x/2.x series it must maintain a high degree of backwards-compatibility with the previous release in the series. As Smart Search is something entirely new and does not bear any resemblance to the regular search component of this or earlier releases it was considered important that users upgrading from those earlier versions would not be forced to change the way search works on their sites. Indeed, activation of Smart Search is something that should be done in a carefully considered way.

Why is There No Search API?

The focus of the present version of Smart Search was in moving code from the old JXtended Finder component into the latest version of Joomla. As that code was already considered stable and there was only a short window of opportunity to port the code over, it was felt that a major redevelopment of Finder was out of scope for the Joomla 2.5 release. Consequently, the code uses Plugins to avoid any changes to the core CMS code, rather than developing a proper search API. We will be looking to create such an API for a future iteration of Joomla.

Can Smart Search Do Faceted Search?

Yes. The advanced search available from the search results page and the smart search module provide an example of how you can filter search results to produce faceted search. There is nothing stopping you from creating your own variations on these basic ideas. For example, you could change the simple drop-downs to accept multiple selections, or you could replace the drop-downs with an array of check boxes.

Why Are Wildcard Searches Not Supported?

The old Joomla search used a very primitive method of searching which relied on the FULLTEXT search provided by the database. This was very inefficient but provided a simple means of handling wildcard search queries. Smart Search provides an autocompletion feature which is effectively a wildcard search of terms in the index, but full wildcard searching is not supported due to the potential for crippling the server if the feature were to be abused. In most cases wildcard searching is used to cater for variations in a search term. For example, searching for juggl* in order to catch references to juggling as well as juggler. Smart Search attempts to avoid the need for wildcard searching by instead supporting word stemming where words that have the same stem are considered equivalent so that searching for juggler will also retrieve instances of juggling without the need to use wildcards.

Can Smart Search Be Used on Multilingual Sites?

Yes, but there are still some issues to be resolved, especially regarding support for Asian languages.

  • To be indexed correctly, you must ensure that all content is valid UTF-8.
  • The Did you mean? feature uses the Soundex function to find phonetically similar search phrases. However, Soundex does not work well for non-English languages and for many languages is doesn't work at all. We are currently researching alternative methods of providing this feature.

If you use Smart Search on a multilingual site and come across any issues, please report them on the tracker so that we can better understand the problems that need to be resolved.

Will jXTended Finder Plugins Work with Smart Search?

No. You will need to update Finder Plugins to work with Smart Search. However, the changes should not be difficult to implement and in most cases will result in significantly less code. If you take a look at the current Smart Search Plugins you should see that updating a Finder Plugin is pretty straightforward.

Smart Search Indexing

Automatic Indexing

Although the Smart Search index is automatically kept up-to-date whenever content items are amended, there are some circumstances where you need to re-run the Indexer. You can do this manually using the Index toolbar button in the Smart Search: Content Map page. However if you need to re-index content automatically then it is also possible to run the Indexer from the command line interface (CLI). This makes it particularly convenient to run the Indexer from a cron job.

From the CLI director the command line is:

php joomla.php finder:index

Typical output from the command line Indexer looks like this:

Smart Search INDEXER
============================

Starting Indexer
Setting up Finder plugins
Setup 154 items in 0.094 seconds.
 * Processed batch 1 in 0.213 seconds.
 * Processed batch 2 in 0.182 seconds.
 * Processed batch 3 in 0.177 seconds.
 * Processed batch 4 in 0.009 seconds.
Total Processing Time: 0.676 seconds.

Purging Before Indexing

Ordinarily, running the Indexer will do an incremental update of the index. That is, it will only update the index for those content items that have changed since the index was last updated. It will not, for instance, remove any items from prior indexing that came from plugins that were uninstalled. So, if you need to completely clear all the existing index entries before completely rebuilding the index, then you need to do a "purge and then index" operation. To do that you can add the --purge argument to the command line, like this

php joomla.php finder:index --purge

Note that this will attempt to preserve any static filters you may have set up, whereas selecting Maintenance→Clear Index on the toolbar will not preserve your static filters.

Setting Up a cron Job

Whilst the specifics are beyond the scope of this article, in general you will merely have to enter the above command into the cron job manager and specify the time or times at which the job is to be run. You will probably need to include the full path to the Joomla! CLI PHP file. For example, like this

php /var/www/myjoomla/cli/joomla.php finder:index --purge

It may also be necessary to specify the full path to the php command such as /usr/local/opt/php@8.2/bin/php.

Out of Memory Issues

If your site has particularly complex indexing requirements it is possible that the standard memory allocation will not be sufficient for the Indexer to run to completion. You can increase the memory allocated to the command-line Indexer using an extra parameter on the command-line, like this:

php -d memory_limit=256M joomla.php finder:index

Replace the 256M with whatever is appropriate for your circumstances.

The command-line Indexer uses the same parameters as the Indexer on the Global Configuration→Smart Search→Index page. You can access these parameters by clicking the Options toolbar button on any Smart Search menu page. The Indexer Batch Size field affects the amount of memory used by the Indexer.

Smart Search Layout Overrides

Results Pages

The Smart Search component has five layout files that you can override to produce a layout to your own liking. To initiate the process from the Administrator menu:

  • Log into the Administrator interface.
  • Click the System menu item, then click Site Templates.
  • Click the Cassiopeia Details and Files link.
  • Select the Create Overrides tab.
  • On the Components panel click com_finder, then click the Search item
  • On the Editor panel select html→com_finder→search to see the list of override files created.

These files will not be affected by Joomla updates but you may be reminded to check them if the original sources are updated.

The Search View (Default Layout)

The default layout search view is divided into several parts:

  • default layout
  • form layout
  • results layout
  • sorting layout

The default layout (default.php)

This layout is very simple. It just defines the structure in which the search form and the search results are displayed. This layout is also responsible for loading the default CSS stylesheet for Smart Search which is located in media/com_finder/css/finder.css, so you might want to alter that to load your own CSS rules for Smart Search.

The form layout (default_form.php)

This layout defines the code required for the search form to operate correctly. The layout uses JavaScript code so you need to take care to preserve selectors that should not be altered unless you know what you are doing.

The view method getFields includes a number of hidden fields that are required for reliable searching. The search term is defined by the input field with the name of "q".

The results layout (default_results.php)

This layout produces the list of matching results for the search term. It also handles pagination and loads a layout for each individual search result.

The result layout (default_result.php)

This is the layout used to display a single result.

The sorting layout (default_sorting.php)

This item is only present if Show Sort Fields is set to Yes and one or more Additional Sort Fields are selected in the Menu Item Advanced tab.

Smart Search on Large Sites

Site Indexing

Smart Search works by creating and maintaining an independent index of search terms in a number of database tables. The problem for large sites is that the indexing process can be quite heavy in CPU, memory and disk usage. Even after the initial construction of the index, incremental updates can also be heavy. The good news is that querying the index is a relatively quick and lightweight operation.

Smart Search is suitable for the majority of Joomla sites. However, search presents particular challenges for large sites. It should be remembered that Smart Search is a pure PHP implementation of a search engine and particularly large sites may be better off using a standalone search engine such as Solr.

To use Smart Search on a large site you will probably need to adjust some of the configuration settings. What follows is some general advice on what to look out for and what to try tweaking. There are a number of known outstanding issues with regard to running Smart Search on large sites which will hopefully be addressed in future versions and these are also described here.

Always Use the CLI Indexer

Because the initial indexing process can take a long time, it is best to run the indexer from the command line to avoid any issues from browser sessions timing out. The CLI indexer will not timeout regardless of how long it takes to complete and it can be easily aborted if problems are encountered. Furthermore, error messages are visible with the CLI indexer, whereas they are hidden when running from the Administrator.

To use the CLI, open a terminal, switch to the cli folder in the root of your site and issue the following command:

php joomla.php finder:index

Batching

The indexer breaks the indexing job into batches of content items. By default the batch size is set at 30 meaning that up to 30 content items will be indexed per batch. Increasing the batch size will potentially make the indexing process faster, but it will use more memory and possibly more temporary disk space.

Out of Memory Issues

If the indexer is running out of memory, try making the following adjustments one at a time until the problem is resolved.

  1. Decrease the batch size. If you have particularly large content items the indexer can run out of memory on even a single content item, so try dropping it to 5 initially and if you still run out of memory, drop it to 1.
  2. If you are able to allocate more memory to the indexer, do so. You can increase the memory allocated to the command line indexer using an extra parameter on the command line. For example, to increase the memory limit to 256Mb use the following command, replacing the 256M with as much memory as you can safely allocate to a process on your system.
    php -d memory_limit=256M finder_indexer.php
  3. Reduce the memory table limit. The default is 30,000 terms which means that as soon as the temporary in-memory #__finder_tokens table reaches this number of rows, the indexer will switch to using a disk table instead of a memory table. It may be that you don't have enough memory to handle a full or nearly full memory table so reducing the limit will tell the indexer to switch to disk sooner and so use less memory. Try 10,000 or even much smaller numbers.
  4. Change the database engine used for the __finder_tokens and #__finder_tokens_aggregate tables from MEMORY to InnoDB. This could seriously impact performance as more of the indexing process will use the disk instead of memory, but it might allow the indexer to finish without running out of memory. Expect the indexing process to run for much longer. This will not affect search performance however.
  5. Try to identify which content items are causing the indexer to run out of memory. If it's not obvious then you might try disabling all Smart Search plugins except one. Running the indexer with only one plugin enabled at a time should reveal which content type(s) are causing the issue. As a last resort consider breaking a few exceptionally large content items into separate items. If the problem is with a custom content type, look at the plugin code and consider indexing less of the available content per item.

Out of Disk Space Issues

The Smart Search index tables can grow quickly! The #__finder_links_termsX tables (where X is a single hexadecimal character) contain one row per term/phrase per content item and a single Joomla article containing 1,000 words will typically result in approximately 3,000 rows being added to these tables. A second article of a similar size will add a similar number of rows even if both articles contain the same words. A site with tens of thousands of articles, some of which may contain thousands of words, is likely to end up with these mapping tables containing millions of rows. It is not unusual for the index tables to occupy several gigabytes of disk space in such circumstances.

With the present version of Smart Search there isn't much you can do about this. However, it is hoped that in the near future you will be able to adjust the number of words per phrase that get indexed. For Joomla! 5 this is hard-wired at 3, meaning that every word that gets indexed is also indexed as part of a pair of adjacent words and as part of a triplet of adjacent words. This is useful for the auto-completion feature and generally improves the quality of search results. On sites where disk space is an issue, it would be good to reduce this to 2 or even 1, so that the mapping tables would be correspondingly smaller.

Notes

  1. There is currently no concurrency locking to prevent more than one process running the indexer at the same time. This will almost certainly result in a corrupt index. Even someone saving changes to a content item while a full index is being carried out could potentially damage the index. As such, it may be safest to only run the indexer when the site can be scheduled to be offline.

Smart Search Options

About Options

Options allow you to manage the Smart Search global settings. The Option settings are inherited by views but the settings in a Menu Item will override the Global settings.

The Options panel is separated into two parts. When you are finished making adjustments, select the Save button. Otherwise, select the Cancel button to abandon any changes.

Search Options

The search options control the behavior of the search forms and search results for the Finder front-end.

  • Result Taxonomy - This option controls whether search results should be shown with their corresponding taxonomy(ies). Defaults to Show.
  • Result Description - This option controls whether search results should be shown with descriptions. Defaults to Show.
  • Description Length - This option controls the maximum character length of the search result descriptions. The descriptions are truncated to the maximum length but the truncation is always done at the last space character so as not to truncate in the middle of a word. Only effective when the Result Description option is set to Show. Defaults to 255 characters.
  • Result Image - This option controls whether images within the searched content are shown in the search results. Defaults to Hide.
  • Result Date - This option controls whether the modification date of the searched content is shown in the search results. Defaults to Show.
  • Result URL - This option controls whether search results should be shown with URLs below the description (if enabled). Defaults to Show.
  • Gather Search Statistics - Defaults to Show.
  • Allow Empty Search - Defaults to Show.
  • Search Suggestions - Defaults to Show.
  • Did You Mean - Defaults to Show.
  • Query Explanation - Defaults to Show.
  • Advanced Search - This option controls whether the advanced search options should be shown. Defaults to Show.
  • Advanced Tips - This option controls whether advanced search tips should be shown. Defaults to Show.
  • Expand Advanced Search - The advanced search options are contained in a collapsible container. This option controls whether the advanced search options container should be expanded by default. Defaults to No.
  • Date Filters - This option controls whether the date filters should be shown in the advanced search options. Defaults to Hide.
  • Sort Field - This option selects the taxonomy field on which to sort the results. Defaults to "Relevance".
  • Sort Direction - This option selects the order on which to sort the results. Defaults to "Descending".
  • Highlight Search Terms - This option controls whether search terms should be highlighted in search results. Defaults to Yes.
  • Enable OpenSearch - Defaults to Yes.
  • OpenSearch Name - Defaults to nothing.
  • OpenSearch Description - Defaults to nothing.

Index Options

The index options control the behavior of the indexer used to process and analyse content for searching. Most settings such as the weight multiplier and stemmer options will not produce immediate changes as they are used during indexing and the effects of changing those settings will only be seen after the index has been purged and run again.

  • Search For Phrases - This option selects whether the indexer should search for phrases as described above. Impacts performance. Defaults to Disabled.
  • Indexer Batch Size - This option controls the indexer batch size. The Smart Search indexer breaks up the total indexing process into a number of batches to reduce server load and avoid PHP's memory and execution time limits. If the content items being indexed are particularly short and/or the server is particularly fast, the indexer can process more items per batch. However, if the content items being indexed are particularly long and/or the server is particularly slow, the indexer has to process fewer items per batch. Defaults to 50.
  • Title Text Weight Multiplier - This option controls how much influence the title text has on the overall relevance score of a search result. Defaults to 1.7.
  • Body Text Weight Multiplier - This option controls how much influence the body text has on the overall relevance score of a search result. Defaults to 0.7.
  • Meta Data Weight Multiplier - This option controls how much influence the meta-data text has on the overall relevance score of a search result. Defaults to 1.2.
  • Path Text Weight Multiplier - This option controls how much influence the path/URL text has on the overall relevance score of a search result. Defaults to 2.0.
  • Misc Text Weight Multiplier - This option controls how much influence the miscellaneous text has on the overall relevance score of a search result. Defaults to 0.3.
  • Enable Logging - creates a log file during the index process. Defaults to No.
  • Default Language - Defaults to None.
  • Filter Common Words - Defaults to No.
  • Filter Numeric Terms - Defaults to No.
  1. Smart Search Quickstart
  2. Smart Search Test Plan
  1. You are here:  
  2. Home
  3. Site Building
  4. Smart Search

  • Joomla! on Twitter
  • Joomla! on Facebook
  • Joomla! on YouTube
  • Joomla! on LinkedIn
  • Joomla! on Pinterest
  • Joomla! on Instagram
  • Joomla! on GitHub
  • Home
  • About
  • Community
  • Forum
  • Extensions
  • Services
  • Docs
  • Developer
  • Shop
  • Accessibility Statement
  • Privacy Policy
  • Cookie Policy
  • Sponsor Joomla! with $5
  • Help Translate
  • Report an Issue
  • Log in

© 2005 - 2025 Open Source Matters, Inc. All Rights Reserved.

Rochen
Joomla! Hosting by Rochen
We have detected that you are using an ad blocker. The Joomla! Project relies on revenue from these advertisements so please consider disabling the ad blocker for this domain.