How the Magento Search Works: What You Should Know For Best Configuration

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…
  • Gentian Shero
  • Co-founder, CEO, & Marketing Consultant
  • July 25, 2017 Estimated reading time: 9 minutes

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. If you’re a larger merchant or you have a larger product catalog, chances are that you’re going to require a specialist, third party solution – however, smaller retailers can work on optimizing Magento’s native search function.

We originally wrote this article way back in 2013 and it was focused purely around configuration on older versions of Magento, so we’ve opted to update it (July 2017). We now cover the Magento search configuration aspects for Magento 1 and Magento 2 and we also look at how third party solutions can help to improve the effectiveness of search considerably, with far less manual work required.

Initially, here are some of the core changes to search in Magento 2.x.

  • Magento 2 Enterprise Edition now uses elasticSearch (previously Solr)
  • Magento 2 Enterprise Edition provides the option of using Elastic, Solr or MySQL in the back-end (stores > configuration > catalog > catalog > catalog search)
  • Magento 2 Community Edition only supports MySQL
  • Magento 2 no longer provides the ‘like’, ‘fulltext’ or ‘combine’ option for matching queries

Configuring search in Magento 2

The native options for configuring search in Magento 2 are largely the same as newer versions of Magento 1, with the main options being to enable auto suggestions, defining the minimum query length and setting the number of recommendations. One fairly big change is that there’s no longer an option around the ‘like’, ‘fulltext’ or ‘combine’, which previously determined how queries would be matched when using the MySQL option.

The below screenshot shows the options presented to users in the Magento 2 admin interface (which can be found at stores > configuration > catalog > catalog > catalog search).

Managing synonyms in Magento 2

Synonyms are handled in the same way as Magento 1 again (marketing > search synonyms). The synonyms function provides a good way of manually optimizing longer tail queries and more generic synonyms that aren’t handled by Magento (e.g. under armour and base layers). If a smaller merchant wanted to use the native Magento functionality, we’d recommend investing time in this area.

Benefits of using a premium third party search solution

We generally recommend that merchants invest in a specialist, third party site search solution, as search is a critical eCommerce function and the native Magento search functionality is fairly weak. We recommend using Klevu, which is a market-leading search solution that uses natural langauge processing (NLP) and machine learning to provide more accurate results and allows for far more complex merchandising.

Klevu’s offering is very strong and it’s also very cost effective (starting from $199 per month) – in our experience it provides very positive results. The primary selling points of Klevu are:

  • Natural language processing (providing more context and deeper understanding around queries)
  • Machine learned results (self-learning based on what users are clicking, adding to cart and purchasing)
  • Advanced product boosting (either at SKU level or based on attribute rules)
  • Comprehensive reporting (around the value queries and which products are performing best)
  • Ability to index more content (we’re in the process of doing an implementation that serves content results, forum results and even UGC results)
  • Quick search UI / excellent UX (rapid search results in a very user-friendly layout)

What to look for in a third party search solution

If you’re looking to use a third party search solution, we’d generally suggest looking to ensure that they can offer the following features:

  • Lightning fast results (rapid auto suggestions UI)
  • Faceted search (ability to use filtering within the results page and auto suggest UI)
  • Natural language processing (lots of the third parties using NLP to provide more accurate results for longer tail queries)
  • Excellent error-tollerance (this is key as a high proportion of queries include errors)
  • Ability to preserve the Magento layout – ensuring that the search results page layout has the same styling and formatting as other Magento templates
  • Content search (to ensure that guides and delivery pages etc can be served within results)
  • Category listings (ability to include category results)
  • Full synonym management (with options around how different terms are handled)
  • Manually promote products (boost and negate specific products)
  • Ability to manage URL redirects
  • Custom error messaging for 0-result queries
  • Reporting around 0-result search queries
  • Ability to handle B2B nuances (such as different pricing for different custom groups within Magento)

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’.
How The 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.

How The 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.

How The 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.

Step 1 – Finding The Magento Search Configuration Options

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:

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

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

The option “Search Type”, which is the 4th option on that form, 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:

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:

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.

Conclusion on Magento search

If you want to get the most out of your eCommerce website, we’d suggest taking the time to experiment with Magento and with third party solutions. Magento’s out of the box search capability is fairly weak, both on enterprise and community edition – there are very few larger retailers still relying on it. We generally recommend using a more enterprise-level solution, such as Klevu – but if you’re not in a position to use a premium solution, we’d recommend either optimizing the native functionality or investing in a premium module, such as the Mirasvit Sphinx module. Again, this can be split tested to get an idea of the impact that a third party solution can have on your sales.

In addition to Klevu (our primary search partner), we’ve also used Nextopia and SLI Systems, which are also good solutions. You can read more about the benefits of the different solutions on this blog post.

If you would like to discuss search in more detail or would like us to review your current setup, please feel free to get in touch with us.

Related Services