Nexcess
Nexcess Blog Logo
July 29, 2019

Magento Search: Uncovering the Benefits of Elasticsearch, SOLR, Sphinx, and MySQL

Storefronts can no longer rely on good navigation alone. Search has become a primary purchasing path, with consumers that use it 200% more likely to make a purchase than those who don’t.

This article looks at the search options available to Magento merchants, and outlines four of the main tools available; including Elasticsearch, SOLR, Sphinx, and MySQL. It examines the pros and cons of each, and provides recommendations depending on merchant requirements.

Keep reading to see which Magento search option is right for your storefront.

Consumers who use search are 200% more likely to convert.

Note: this article will not be taking a detailed look at the multiple Magento search extensions available on the marketplace, but instead focuses on more powerful, external solutions.

  Get started with a 1-click activate Elasicsearch container. Learn more.

How Magento Search Works

Once a search engine is installed, it immediately gets to work by indexing content on your site. For ecommerce sites, this means creating a “list” of products along with their attributes. This indexing process is continuous. Every time an update is made to your site (a new product added) the “list” needs to be refreshed. 

For example, you may add a new set of headphones to your website. The search engine will then index things like its title, description, and price. It will also index attributes you have specified such as connection type, whether it’s noise cancelling, etc. 

When a user inputs a search query, the search engine will sort through the list of products and their attributes, and then bring back the most relevant. Different search engines do this in different ways and have different features for interpreting and filtering more complex data.

Elasticsearch, the most popular search tool available, does this primarily with JSON (JavaScript Object Notation). Here, different attributes are marked up during product creation and then used during the search process to compile relevant results.

Because of JSON being such a powerful and fast programming language, Elasticsearch means that merchants can provide search values outside of just text-based strings. In the case of some other search engines (MySQL), this functionality is very limited.

What to Look for with Magento Search

Regardless of which search engine you opt to use, there are six features that you need to focus on:

  • How long do the indexing and results compiling processes take? The longer these take, the slower your search is going to be.
  • What languages can the search engine handle? Decide what language is best for your store first and then make sure your search engine provides support for it.
  • What natural language processing features are there? This isn’t just important now, it will be important for voice search too.
  • How does faceted search work and how detailed can filters get?
  • How accurate is the search engine? It’s worth trying the search engine first to see if it really does provide accurate results. 
  • Synonym management (especially important for niche stores)

With these six features in mind, we’ve taken a look at four of the most popular search options available to Magento merchants.

Each of the options below are acceptable for use on a modern store. However, there is one that can really unlock powerful search for merchant sites.

Elasticsearch

Elasticsearch (ES) is currently the most popular and the default option for Magento search. 

As a java-based document store, Elasticsearch is engineered to store large numbers of JSON documents and speak to them natively. So in addition to being able to handle text-based queries, it can also understand advanced analytical queries too, including interpreting numeric and geo data. 

Where Elasticsearch really shines is in its full support for Apache Lucene’s real-time search. From a customer’s perspective, this means ES is able to provide faster and more relevant search experiences. For store owners, this means faster conversions. 

Adding Elasticsearch to the Magento Catalog Interface

Currently, Elasticsearch is recommended by both us and Magento. Part of the reason for this is that it’s easy to set up. On Nexcess accounts, it can be turned on under the Environment tab in your Client Portal. The endpoint can then be transferred into Magento by following this guide

At the moment, both Foursqaure and Github use Elasticsearch.

A Faster, More Accurate Search Option

For 74% of consumers, the quality and relevancy of search results on an ecommerce site is the difference between whether they do or don’t make a purchase. Elasticsearch helps to make searches relevant even when the searcher isn’t sure what they’re looking for with fuzzy searching.

Fuzzy searching allows for stores to interpret customer queries by taking textual queries and interpreting them based on more than just 1-to-1 word comparisons. Combined with synonym and stop word interpretation, this places ES as one of the more capable search engines available to merchants. 

Elasticsearch is able to provide faster and more relevant search experiences leading to more conversions. 

ES also allows for merchants to customize search results based on defined parameters. One of the technologies used to do this is finite state transducers. In English, this means that ES can handle search queries that consider both the input and output, and can then provide results based on the relationship between these two pieces of data. 

Complex Search Query Support

While both Elasticsearch and SOLR (below) are based on Lucene query parsing, Elasticsearch provides support for structured query DSL. This allows for more complex search queries not supported by a just-Lucene search engine. 

Elasticsearch also supports scoring scripts, which can be written and implemented through JavaScript. At this point in time, SOLR does not offer this functionality.

Official and Community Library Support

Official: Java, PHP, Javascript, Python, Groovy, Ruby, Perl, .NET, 

Community:  Java, JavaScript, PHP, Python, R, Ruby, Clojure, Cold Fusion, Erlang, Go, Groovy, Haskell,.NET, OCaml, Perl, Scala, Smalltalk, Vert.x 

Elasticsearch Pros

  • Has become the default replacement for the default Magento MySQL Search Engine 
  • A little faster than SOLR
  • More aligned with modern web development practices (so likely easier to use)
  • Ready to go out of the box with the Nexcess Elasticsearch Container solution

Elasticsearch Cons

  • Will take up space due to indexing
  • Can cost extra for hosting space
  • Requires lengthy indexing

 

  Learn more about Elasticsearch and how it can elevate your ecommerce platform now. 

 

SOLR

Another standalone, scalable search option for Magento. For a long time, SOLR dominated the Magento search market for high-traffic sites. Not only does it offer a number of important features search admins are looking for, it’s also a scalable solution capable of handling heavy traffic loads.

Some of the features you’ll find with SOLR search include:

  • Search term suggestions based on misspelling
  • Weighted search results
  • Layered navigation
  • Powerful autocomplete
  • Relevancy management
  • Support for synonyms and stop words

At the moment, Cnet and Netflix use SOLR. 

Near Real-Time Search Speeds

Where SOLR shines is when it comes to group searches. This is because SOLR supports distributed groups (including grouped sorting, filtering, and faceting). For ecommerce stores, this allows customers to customize their search experience to provide more relevant results. At this point in time, the main competitor, Elasticsearch, does not support this in the same way. 

Powerful on-site search provides more than just a direct purchasing path. It also provides customers with an avenue for research.

When compared to alternatives, SOLR is a more complicated search engine to implement. Not only does SOLR’s interface take longer to learn than Elasticsearch’s, its deployment also requires a little more knowledge.

If you’re looking for some added functionality that comes with additional work, then SOLR may be a good choice. However, in 99 cases out of 100, we would recommend Magento store owners opt for Elasticsearch. 

Official and Community Library Support

Official: Java

Community: PHP, Python, Javascript, Ruby, Erlang, Perl, Scala, Go, Clojure, .NET

SOLR Pros

  • A popular search option for Magento 1 stores
  • Does not require a massive indexing process
  • Truly open source

SOLR Cons

  • Harder to implement
  • No longer the latest and greatest in Magento Search

 

Sphinx

Sphinx is a powerful Magento search tool capable of indexing multiple content types and with support for multiple written languages. While not as powerful as the options above, it’s favored by a lot of Magento 1 stores due to the ease of integration.

Sphinx is currently used by Mozilla, Craiglist, and Dailymotion.

Fast Search From a Premium Module

By default, Sphinx doesn’t run through an external container but an extension that can be downloaded through the Magento Marketplace. Despite this, it’s still capable of holding its own when pitted against the other options on this list. 

From their own documentation, Sphinx is able to deliver over 500 queries/second when a product catalog consists of over 1,000,000 skus. 

In terms of its actual search capabilities, Sphinx includes a number of features you see with most of the other search engines listed here, including:

  • Synonym and plural form support
  • Long tail search 
  • Stop word support

Sphinx also allows for multiple search types, including products, categories, attributes, and blog content. Its morphology preprocessors allow for different word forms to be replaced with their base form. In Sphinx’s example, this means translating Dogs into Dog. There are, of course, much more complicated use cases where this helps to provide unique and highly-relevant results for customers. 

Sphinx is able to deliver over 500 queries/second when a product catalog consists of over 1,000,000 skus.

A Magento 1 Search Tool

While we always recommend using Elasticsearch, we’ve found that when Sphinx is used it tends to be with Magento 1 stores. If you’re running a Magento 2 store, Elasticsearch is a better option – especially if you’re just getting started or are in the process of replatforming from magento 1

If you’re interested in how to configure search on Magento 1, then we recommend checking out this article from Shero.

Sphinx Pros

  • A powerful search engine used by a lot of large, popular sites
  • Years of development have made it stable

Sphinx Cons

  • Not as well supported as alternatives
  • Lacks the speed of Elasticsearch and SOLR

 

MySQL

The original default search engine for Magento. While competent in its own right, it doesn’t compare to the enterprise options available. Moreover, the MySQL search option for Magento has now been deprecated. Instead, Magento 2 is now configured to use the Elasticsearch search option by default. 

The default MySQL search is also missing some other features you’ll find with SOLR or Elasticsearch, including suggestions, clustering, attribute weights, and tips when zero results are returned.

MySQL search options through the Magento Catalog

For this reason, we recommend avoiding the default MySQL search option. With the current ease of integration afforded by Elasticsearch, why wouldn’t you want more powerful search powering your Magento store?

MySQL Pros

  • It’s free

MySQL Cons

  • It’s not nearly as powerful as other options
  • It has been deprecated 

Expanding Magento Search Functionality Through Extensions

If you own a smaller Magento store and don’t want to invest in a dedicated search engine, then it’s also possible to expand the search functionality of Magento through extensions. These can be found and downloaded from the Magento Marketplace

The Best Magento Search Engine

We recommend that all merchants make the move to Elasticsearch. Not only because it’s easy to integrate with your Magento store, but also because it provides numerous improvements over the alternatives. 

While speed and performance is comparable to SOLR, Elasticsearch does have a slight edge. It also allows for consumers to make more complex searches with more relevant results, thanks to a number of additional features such as fuzzy searching, full indexing, and DSL query support.

In terms of development, Elasticsearch also provides much more in terms of official and community client libraries. This means that your developer is more likely to be able to handle and scale it efficiently. Combine this with its out of the box readiness on the Nexcess container platform, and it becomes the clear search engine choice for most Magento stores.