How the Magento Search Works

One of the most common questions we receive is how to optimize the Magento search function to get the best results. The truth of the matter is that it depends on what you are looking to do – with requirements differing for different types and sizes of businesses.

Configuring search in Magento 1.x

This section is focused on what you need to do in order to make results in Magento 1.x more accurate, if you’re using native Magento search. In Magento 1.x, there are three core search options, which are provided to you when you configure your search settings. The three options available to you are ‘like’, ‘fulltext’ and ‘combine’.

  1. How ‘Like’ Search Option Works
    The ‘like’ method is based on a database query method that states “Find me results that are similar to this keyword”. So if you are selling notebooks and notepads, and somebody on your website types the word ‘note’, the ‘like’ search setting will allow that user to view all options where the product name has the word ‘note’ in it. It is considered a more ‘loose’ approach to searching because you are not forcing the user to only view results that are a 100% perfect match with your keyword.
    This type of option can have performance issues and is not based on ‘relevance’ at all so it is not the most accurate method of searching. Its primary benefit is the ability to find products if a customer accidentally mistypes a product name. This is why many people prefer the ‘fulltext’ method.
  2. How ‘Fulltext’ Search Option Works
    If you select ‘fulltext’ as the ‘search method’ for your store’s search engine, you will be providing your visitors with a search that bases results on relevance. It will *not* find partial matches, so if you type note in the search box, you are not going to see ‘notebook’ products listed.
    What it will do, though, is, behind the scenes, calculate which products are the best match for your search so if you have a few products with the keyword in the title, since Magento also searches the description of a product, it will be able to weigh which listings are worth showing first. The advantage to this method is you are providing a higher quality listing of products based on their search. The potential disadvantage is that if they make a mistake on typing the keyword, they will not find the product they intended to find. This is why the third option, titled ‘combine’, may be appealing to some people.
  3. How ‘Combine’ Search Option Works
    The ‘combine’ method uses the power of both ‘like’ and ‘fulltext’ searches. When it comes to matching product titles with the keyword, just like a ‘like’ query, it will allow for partial words to be matched such as ‘note’, as a search word, pulling up listings for ‘notepad’ – something a ‘fulltext’ search will not do.
    As for generating results, the ‘combine’ method, while it is flexible when it comes to finding products with a partial match of the keyword, it uses the flexibility and power of the ‘fulltext’ search in order to sort results by relevancy. Therefore, as it is described in its title, it is combining the benefits of ‘like’ and ‘fulltext’ searching. Now that you are familiar with the logic behind the three magento search options, it is time to learn how to configure your search feature.

Configuring it on the backend

When you are logged into the Magento admin, you will notice a navigation menu at the top. The link at the far right is titled “System”. Put your mouse over that and you will see a drop down menu and, on that menu, the last link at the very bottom will be titled ‘configuration’.
Click on ‘configuration’ and you will see a page where there is a menu of links on the left side. Scroll down the page and look for the ‘catalog’ link:

Screen-Shot-2013-06-13-at-12.53.44-PM

You will then see the page where the search configuration options reside. This is what you will see:

Screen-Shot-2013-06-13-at-12.55.03-PM

Click on the ‘Catalog Search’ menu item and then you will see the catalog settings:

Screen-Shot-2013-06-12-at-5.42.32-PM

The option “Search Type”, is where you will tell Magento to use a ‘like’, ‘fulltext’ or ‘combine’ search option. When you make your selection, there will be one more step before this becomes official; indexing your search catalog.
After you make your selection for ‘search type’ you will have to pay attention to the top of the admin page. You will see this:

Screen-Shot-2013-06-12-at-5.44.05-PM

Click on the “Index Management” link and you will be taken to the page that allows you to re-index your search catalog. This is a necessary step for Magento to properly adapt to your new search type setting. When you are on that page you will see this:

Screen-Shot-2013-06-12-at-5.44.21-PM

You will notice that there are two rows with a red background. The red background is telling you “Please, re-index me”. To do this, all you have to do is select the checkbox for that row (in this case, select both rows) and hit the submit button. You will then notice the page will need a few moments to properly handle your request.

Important Note About Re-Indexing:

Large catalogs with over 5,000 products will take more time to re-index than those catalogs with only a few hundred products. So be patient while this process is in progress. You will be notified of the completion of the re-indexing with an alert message, at the top of the page, telling you that re-indexing is complete. At this point, you will notice that the former red background items are now loading a green background. This indicates that you have successfully performed your re-index. You are now ready to show off your new search setting. Should you need to change the search setting again, simply follow the steps in this article and you will be good to go.

One of the most common questions we receive is how to optimize the Magento search function to get the best results. The truth of the matter is that it depends on what you are looking to do – with requirements differing for different types and sizes of businesses.