Open menu
How to Improve Magento Search Results

How to Improve Magento Search Results

How to Improve Magento Search Results

According to numerous studies, those who use your on-site search bring higher conversions. Well, that’s reasonable: these people know what they want and have a strong intent to buy. The rest perform a search just in case and might not have exact plans. Anyway, the outcomes largely depend on the search results. Will they be relevant and delivered quickly?

Searching in Magento stores may be exhausting. For example, an in-built MySQL search can show tons of irrelevant items, find nothing because of typos, or can’t search by attribute weights. That’s why you might see the following picture: the traffic is excellent while the conversion rate is lower than expected. To change this, you have to optimize the Magento search.

The Magento search optimization path will depend on the solution used in the store. You might have a native search with MySQL, Elasticsearch, or a third-party solution. Below we’ll regard how to make Magento show better search results in all these cases.

  1. On-Site Search: Important Stats
  2. Step 1: Accelerating Magento Search
    2.1 If You Have a MySQL Search
    2.2 If You Have Elasticsearch
    2.3 If You Have a Third-Party Search Engine
  3. Step 2: Enhancing the Relevance of Search Results
    3.1 What Influences the Relevance of the Search?
    3.2 Does Size Matter When You Want to Improve Magento Search?
  4. Step 3: Working on User Experience

On-Site Search: Important Stats

Consulting companies and B2B services constantly study the role on-site search plays for online retailers. Take a look at some data:

  • Users utilizing store search are 2.4 times more likely to place an order. More to say, people who use the search in online stores spend 2.6 times more than those who don’t (Salesforce, 2019).
  • Big names in online retail report the substantial rise of their conversion rates when consumers search on-site. Walmart’s CR goes to 2.9%, which is 2.4 times more than for sessions without the search. Amazon noticed a striking 6x soar, from 2% to 12% (Algolia, 2020).
  • A poor search experience scares away potential customers. Up to 80% of shoppers leave eCommerce websites because of irrelevant search results, tangled navigation, and insufficient product information (Forrester, The State of eCommerce Experience, 2020).

These figures underline the significance of the search feature both for customers and the wellbeing of your business. After all, you want an easy-to-use, fast, and convenient store that converts, is SEO-optimized, and answers to the Magento Core Web Vitals standards.

Now let’s dive into the strategies and tactics that help enhance search in Magento stores.

Step 1: Accelerating Magento Search

The possible measures depend on the type of search enabled in your store. There are three primary cases, and we’ll examine them all.

1. If You Have a MySQL Search

Magento Search Engine with MySQL

Up to version 2.4, Magento implies MySQL as a default search option. And many actually use it. MySQL is a database that stores all the platform’s data and processes (not only search but also other queries like displaying a catalog and product pages).

When a store is relatively small or not heavily loaded (e. g., one visitor in 5 minutes), this native search might be enough. Otherwise, some problems with the search speed are likely to occur.

There can be several issues behind slow Magento search with MySQL.

a) The code is written with substantial mistakes
For instance, every time a customer searches in the store, Magento performs some unnecessary operations, e.g., extra table joins. The data in them is irrelevant to the search, but it takes time to analyze it. As a result, each request may run a couple of seconds slower.

To resolve this issue, developers need to revise and optimize the code. A profiler will help to find chunks of code that take longer to execute. And don’t forget that database optimization helps a lot to speed up Magento’s backend on the whole.

b) The database is overloaded with queries
If hundreds of people (or more) are simultaneously in an online store, MySQL is likely to be overwhelmed. This can even lead to the website’s general slow down.

In this situation, the best way out is to unload MySQL by passing the search feature to another service (and server). There can be many options, but the most popular is a search engine called Elasticsearch which we’ll talk about next. Older Magento versions can be integrated with Elasticsearch via extensions.

2. If You Have Elasticsearch

Elasticsearch for Magento
Starting from version 2.4, Elasticserach replaced MySQL and became a default search option for Magento. Why was this done? Firstly, Elasticsearch is geared for search: it’s faster than MySQL and more flexible in tweaking terms.

Secondly, this measure frees Magento itself from handling the search feature. Basically, such queries are regarded as heavy due to numerous criteria they have to meet. Adobe detached the search logic to offload MySQL and optimize the overall Magento page speed. Besides this, developers usually install Elastic on a separate server so that the search doesn’t consume the resources of the main one.

But even so, your store equipped with Elasticsearch isn’t immune from problems with search speed. Here are some of them.

a) Lengthy rendering
As a rule, Elasticsearch returns the needed response quickly. But sometimes, not all product data is kept in Elasticsearch, and for displaying results, Magento has to seek and load it from its own databases. This makes users wait longer.

For instance, we need to showcase the following info in search results: product names, core characteristics, a link, and an image. All this data fetches from Elasticsearch, except for photos saved in Magento. If you transfer them into Elasticsearch, you’ll reduce the number of queries to Magento and accelerate the data output. By the way, check out our Magento image optimization guide on how to make media files load even quicker.

Prices and other dynamic data are traditionally stored in Magento. But you can keep all static data in Elasticsearch and generate search results based mostly on it.

b) Incorrect queries
Excessive and repetitive queries are quite widespread performance issues. There can be multiple identical requests instead of asking for the needed data once. It’s a common programming mistake that requires code optimization.

c) Problems with data display
Developers can set the data output differently and sometimes do it in a non-optimal way. For example, instead of displaying the first 10 products and then loading the next portion, they try to show hundreds at once.

It’s up to the client to choose the quantity of results to show. But if a developer realizes they can’t display this number quickly enough, it’s better to take the safe route: show fewer items and load new ones as shoppers scroll.

There are many more unique cases of this kind that developers must find for general Magento speed optimization and to improve Magento search in particular.

d) The choice of the server
If Elasticsearch is on the same server as Magento itself, the search functionality consumes its resources, negatively affecting the site’s speed. To avoid it, we’d recommend you allocate a separate server for the search.

Most importantly, Elasticsearch must be in the same local network as your main server. Otherwise, waiting for a server response may take extra time. Eventually, customers won’t see the benefits of hosting search outside the main store.

Magento hostings (Sonassi, Nexcess, and others) offer Elasticsearch as one of the services. Store owners who run their websites on AWS can use its version of Elasticsearch.

Due to amendments in the Elasticsearch licensing, AWS has recently introduced the OpenSearch project, a fork of open source Elasticsearch. Currently, AWS is supporting versions of the original Elasticsearch as well. Anyway, we think the changes won’t affect Magento stores.

e) Incorrect instance type
This problem can occur if you’re renting a third-party service. You’ve chosen a solution with particular configurations of CPU, memory, and storage capacity. If the store becomes more popular, the initial instance won’t be sufficient.

f) Incorrect settings of Elasticsearch
If configured by your developers, Elastic can operate with lags. That’s why online stores often opt for third-party services that take care of all the necessary database tweaks. These are cluster set up (the master server for taking queries, the server for updating the database, separate servers for processing and responding to queries), cross-cluster replication, indexing buffer settings, and more.

3. If You Have a Third-Party Search Engine

Algolia SaaS-based search tool

There are many SaaS-based search tools on the market. As a rule, they feature some kind of smart search output, offer the ability to deeply customize the accuracy of search, focus on speed and high scalability, as well as collect search insights from user sessions. Let’s briefly talk about a few options of this kind.

a) Algolia
This provider uses machine learning and natural language processing to reach higher precision of results. Its algorithms learn from users’ actions to refine each subsequent search session and live up to customers’ expectations. Also, Algolia supports voice search for mobile apps, websites, and smart speakers. It promises high-speed search, no matter where it happens geographically, thanks to a distributed search network.

b) Searchspring
The company is primarily focused on delivering accurate search results thanks to live indexing and semantic search. Searchspring also offers advanced merchandising possibilities. Store teams can make arrangements for various search queries: e.g., move the bestselling, highly rated, or more marginal products to the top of the search results.

c) Sooqr
This solution is compatible with Magento and aims to improve search performance both in speed and relevance terms. Sooqr states to leverage attributes for fetching accurate results, filtering, and sorting. The company says its error tolerance is able to cope with up to 80% of users’ mistakes.

d) Klevu
The provider utilizes machine learning and natural language processing for the sake of accurate search results. Besides this, Klevu offers an AI-based merchandising strategy and personalized product recommendations.

Third-party SaaS Search Tools vs. MySQL and Self-hosted Elasticsearch: What’s the Difference?

Those store owners who use third-party SaaS search tools can’t see what’s under the hood and change how the database operates. A customer gets an API to enter data and is able to configure settings for better relevance of results while the provider takes care of the rest.

If your online store is equipped with a third-party service and experiences speed-related problems with search, there could be a couple of reasons for this:

a) Lengthy rendering
Probably, deceleration occurs at the stage of rendering results on Magento. As we said before, your team can fix it by code optimization.

b) Slow information retrieval
Sometimes the service you use returns results slower than usual. In this case, the only thing you can do is report this provider so that its support team finds and resolves the problem.

Anyway, the very first step is to use a profiler. Check where the slowdown starts, how long it takes to get the result from the service, and then process the result in Magento before displaying it to a user. We’d recommend having not only an in-built Magento profiler but also Xdebug for debugging the code and Newrelic for the code execution analysis.

Step 2: Enhancing the Relevance of Search Results

In relevance terms, we strongly recommend every Magento store owner to give up MySQL as a search option in favor of more agile services designed specifically for finding products. Elasticsearch and SaaS products can be thoroughly configured to improve Magento search relevance.

In turn, in-built MySQL search isn’t so adaptable:

  • MySQL can deal only with exact matches (alternatively, even the out-of-the-box Elasticsearch is able to search by misspelled words).
  • Magento MySQL search doesn’t support features like search by synonyms.
  • MySQL can’t search, taking attribute weights into account.
  • MySQL is poorly optimized to search a part of a string inside the whole line: it will do this far longer than other search engines.

Why is that so? MySQL is designed to retrieve search data as well as store data, process queries, and make calculations. But it’s unable to support more advanced search: by synonyms, words with typos, etc. It will be difficult to apply additional features to it, and there is a big chance this functionality won’t reach the level of specialized services.

Anyway, whether you have a native MySQL search, Elasticsearch, third-party search engine, or a hybrid solution, it’s your team’s task to determine and set all possible parameters for more relevant results. Prior to the start of optimization, it’s vital to research users’ behavior and collect data in the following areas:

  • Popular queries;
  • Popular categories;
  • Queries with no results;
  • Typical typos;
  • Frequently used synonyms and word forms.

This valuable information will give you insights into how to improve Magento search and show products as accurately as possible.

What Influences the Relevance of the Search?

Now let’s consider core parameters that influence the relevance of the search. Note that possible options and ways to apply them may vary depending on the used solution.

1. Attributes and Their Weight

Attributes (like a product name, description, color, weight, or SKU) largely define the relevance of search results.

For instance, we’ve prioritized a description over a name. When a visitor types “trenchcoat”, a search engine will firstly showcase products with this word in descriptions, not in product names. Will results be accurate enough? Not as much as we would like them to be.

That’s why it’s essential to prioritize attributes correctly (in the standard settings, the weight of all attributes will be the same). We advise you to give the highest priority to product names.

Attributes in Magento search
2. Search Types

MySQL (in Magento 1) offers three search types:

  • “Like”;
  • “Fulltext”;
  • “Combine”.

Elasticsearch supports “Fulltext” by default. Why? Because “Like” will search each word from a query separately, returning not as exact results as a shopper would expect. For instance, for “beige trenchcoat” it might display all beige items as well as all trenchcoats.

In the meantime, when the “Fulltext” mode is enabled, the search focuses on the whole phrase and retrieves far more precise goods. “Combine” will unite the results obtained in the first two ways, again leading to many irrelevant products.

3. Autocomplete

As a concept, autosuggest is an extremely wholesome option for shoppers. In practice, this feature could be a double-edged sword if configured incorrectly.

For example, Elasticsearch has a so-called fuzzy search. It changes letters one by one to find the term that a visitor might have meant. You can set the number of letters to which this substitution applies. With a wrong configuration, the fuzzy search might turn a query into nonsense. In turn, MySQL doesn’t even have such functionality.

Search autocomplete on Bright Star Kids

4. Synonyms of All Kinds

You have to foresee everything: synonyms, possible word forms, and common spelling mistakes.

When it comes to Elasticsearch, you can create synonym sets based on the users’ requests analytics in the engine menu.

5. Redirects

The analysis that you’ve done could prompt you what prospects seek most commonly. Add direct links to these categories or pages so that people land on the desired page straight away without browsing through the whole list of results.

Does Size Matter When You Want to Improve Magento Search?

The search option to choose hugely depends on the size and peculiarities of your online store as well as business tasks. The general advice would be the following:

a) A small store (up to 100 products)
Presumably, the quantity of categories and goods allows users to navigate relatively easily across your online store. Predictive search (autocomplete) requirements might be simple, and there’s no need for advanced search settings. Besides this, such a store doesn’t experience high loads. In this case, an in-built MySQL search can be adequate to the number and complexity of searches.

b) A middle-size store
The blazing-fast speed and impeccable relevance of search results are essential since you have manifold positions in the catalog. We’d recommend switching to Elasticsearch and fine-tuning it to keep the shopping experience of your regular and new customers great.

c) A large-size store
You have tens of thousands of commodities, plenty of categories, and subcategories. Besides this, you can be present in markets around the globe. These factors raise the need for an advanced search solution.

Let’s say your Magento store is placed on the servers in the US. But you need to ensure equally fast and stable search not only for American customers but also for European, Arabic, and Asian.

If you go with Elasticsearch, you’ll need to lease servers in different places and deal with distribution which is a tough task.

So, in this case, a SaaS solution is the best choice since these services usually provide distributed search. A network of data centers all over the world handles search queries in corresponding regions to cope with network latency.

For instance, one of our clients (25.000 items; several languages, including French, German, and Spanish) opted for Algolia. This provider has a distributed search network of more than 70 data centers in 17 regions. Of course, it comes at a price affordable for enterprise-level businesses rather than smaller stores.

In any scenario, we’d recommend conducting A/B tests to find out what is better for your store’s UX and conversions: Elasticsearch or a third-party solution. And only if a SaaS search engine turns out to be more profitable and adaptable to customers’ needs, it’s reasonable to pay for it.

Step 3: Working on User Experience

Finally, search usability is almost as important to purchasers as its speed and relevance. There is much room for improvement with some differences for small and large stores as well as for desktop and mobile versions.

We’ve explored the best UX\UI practices for eCommerce site search in a separate guide. What will you choose: a search bar or an icon? What is a pop-up search screen? How should you organize fast search results conveniently for shoppers? Is it worth showing search history or not? We’ve covered all the big and small UX\UI aspects defining a flawless search experience.

To Conclude

We’ve outlined many ways to refine the search experience for Magento. It’s quite a challenging task, true. Every single store has its peculiarities and goals that require different software solutions and optimization strategies. But the major aim for every Magento store owner is to improve search so that it becomes faster, handier, and shows exactly what people want to purchase. It’s a great deal of work needed to reach satisfactory results. The Onilab team is ready to help with this and other types of Magento speed optimization services.

Magento tips from real projects
Magento tips from real projects
CALL US 24/7:
& asia
+61 (02) 8005-7494