Magento Search Function and Search Terms Tutorial

How to manage the search function and search terms in Magento

Magento has a built-in search function that makes it easier for customers by using keywords to find the product they are looking for. On the frontend customers can use the quick or advanced search to find products, and they can also view and use the popular search terms used by other customers. The backend of your Magento has various options that allow you to view reports of the search terms used by customers, to modify and add search terms, and to configure the system options of the search function. In this way you can make products easier to find and increase the likelihood of customers finding and buying the desired product(s).

In this tutorial we'll go over the different search term and search function options.

Quick, Advanced Search and Search Terms on the Frontend

After you install Magento the search function is enabled by default. On the frontend there's a search bar which customers can use to perform a quick search by typing a keyword(s) in the field:

Quick Search on the Frontend

In the footer of the frontend there's also an Advanced Search link which will open the page with the advanced search form:

Advanced Search on the Frontend

It can be used to perform a search based on the product's name, description, etc.

By default, in the footer of the site there's also a link called Search Terms. By clicking on it customers can see the most popular search terms:

Popular Search Terms on the Frontend

The more popular terms are displayed with bigger letters. The terms are also links and by clicking on a term a search for that term will be performed.

If you want to, from the admin panel of your store you can disable the popular terms function. To do this go to System menu>Configuration, click on the Catalog button that's under the Catalog menu on the left, then select the Search Engine Optimizations panel on the right, set the Popular Search Terms drop-down menu to Disable and click on the Save Config button.

If you want to, it's also possible to remove the Advanced Search link from the footer. To do this you need to modify the catalogsearch.xml file of your theme. For more information on this check out the tutorial on removing blocks and links in Magento that cannot be removed from the admin panel.

Although it doesn't make much sense you can disable the search function altogether. To do this, in the admin panel of your Magento go to System menu>Configuration, click on the Advanced button that's in the Advanced menu on the left, click on the Disable Modules Output panel on the right (if it's not expanded), set the Mage_CatalogSearch drop-down menu to Disable and click on the Save Config button. This will only disable the function, it will not remove the search bar and the other search related links from the frontend.

Search Term Panels on the Dashboard of the Backend

When you log in to the admin panel of your Magento the first thing that is displayed is the dashboard. Among other things, it contains two tables for the last five search terms and for the top five search terms:

Search Term Tables on the Dashboard

They can be used just as a quick reference.

Editing and Adding Search Terms

If you want to see more details about the keywords that customers have used to search on your site, if you want to edit them and/or add new ones, if you want to set a landing page for a particular term(s) and to set up search term synonyms, log in to the admin panel of your Magento and go to Catalog menu>Search Terms. On the page that opens you'll see a table with the search terms that customers have used (and those, if any, added by you manually):

Adding and Editing Search Terms

In the table you can see the exact search query as used by the customer(s), the matching products (results), the number of times the same query has been executed, as well as whether the term is redirected to a particular landing page, and whether it's a synonym for another therm.

You can edit these settings for any of the existing terms by clicking its Edit button or simply on its row in the table, and you can add new terms by clicking on the Add New Search Term button that's above the top right corner of the table. In both cases the settings are the same. The only difference is that when you edit an existing term there will be options for the number of results that the term produces and the number of times it was used (these two options are not shown when adding a new term):

Search Term Settings

Let's go over the settings in more details:

  • Search Query-this is the keyword or keywords that the customer(s) searched for. In our example screenshot a search was performed for the phrase hostknox sneakers. You can control the minimum and maximum number of characters that customers can use per query. This can be done from the system configuration settings. We'll come to this a bit further down in this tutorial.
  • Number of results-when editing an existing search term this option indicates the number of products that matched the query.
  • Number of Uses-this shows the number of times that customers have performed a search using that term.
  • Synonym For-the field for this option is empty by default. You can use it to relate search terms. When a customer performs a search by using the word(s) specified in the Search Query field, the results that are returned will be based on the term specified in the field for Synonym For. Let's make it clearer by giving an example. Let's say that you have added computer processors as products but you have used in their names and description the abbreviation CPU instead of the word processor. So when somebody searches by using the term CPU the products will be displayed as results, and when processor is used there will be no matches. You want both terms to match the products. In this case, if the two terms don't exist already, create them, then edit the processor term and in its Synonym For field type CPU. This is a very useful trick for making your products easier to find.
  • Redirect URL-this option can be used if you want searches for the term to show a particular page on your site or on an external site. For example, you want searches for the term support to display a static customer service page that you have added to your site. Then you need to add/edit the term and in the field for Redirect URL you have to type the full URL address of the page (e.g. http://yourdomain.com/customer-service).
  • Display in Suggested Terms-this option, as the name suggests, is for displaying the term if a search doesn't produce any results. When you add a new term manually this option is set to No by default. While when a new term is added automatically after a customer performs a search by using a term that doesn't exist, the option is set to Yes.

When you're done with the settings don't forget to click on the Save Search button. If you edit any terms or you add new ones, you should also reindex the Magento data from System menu>Index Management.

If your store has multiple views (e.g. a multilingual store), there will also be a search term option for the store view:

Search Term Settings with Multiple Store Views

Search Terms Report

In the reports section of Magento's admin panel there's also a report on search terms. To accesses it go to Reports menu>Search Terms. This will show a table with the terms for which customers have performed searches (with the number of results and hits for each term):

Search Terms Report

This is information that you can also obtain by going to Catalog menu>Search Terms. Clicking on any of the rows in the table will display the settings of the term.

System Configuration Search Settings

There are some system settings connected with the search function that apply to all search terms, and to the search function in general. To view and change them, in the admin panel of your Magento go to System menu>Configuration, then on the page that opens click on the Catalog button that's under the Catalog menu on the left, and from the panels that appear on the right select Catalog Search:

System Catalog Search Settings

There are several settings that you can configure. From the respective options you can set the allowed length of the search term or phrase and also the allowed number of words within a single query. By default, the minimum length is set to one character and the maximum to 128 characters. The maximum number of words within a search phrase is set to 10. The Search Type option is set to Like by default. This means that partial matches will be returned as results. For example, a search for host will match not only host, but also hosting, hostknox, etc. Another search type that you can choose from the drop-down menu is Fulltext. In this case only exact matches will be returned as results; using our example, a search for host will not return as results hosting and hostknox.

Depending on the options that you change, if you make any changes, you may need to reindex data.