Using Sphinx Search in Magento projects

In addition there are specific products, which we can’t find by simply passes of catalog. And it’s necessary to have advanced search algorithm. For example, when there are a very large number of items (more than 10,000), or difficult to find a specific product among 100 nearly identical names.

Currenty Magento supports three types of search:

  • Like search by field data_index of table catalogsearch_fulltext
    LIKE ‘%search%query%’
  • Fulltext search by field data_index of table catalogsearch_fulltext with expression:
    MATCH(data_index) AGAINST (‘search query’ IN BOOLEAN MODE)
  • Combine (Like и Fulltext) search:
    (LIKE ‘%search%query%’) OR MATCH(data_index) AGAINST (‘search query’ IN BOOLEAN MODE)

There are two main criteria characterizing a particular type of search:

  • Search quality (relevance)
  • Search speed

If we consider the types of searches that Magento has by default, then we can say that the average speed of search is the same for all three types, depending of the number of active items and the number of store views (stores).

Relevance of search results is quite different for different types. To achieve good search quality for catalog with quantity of products more than 1000 will be difficult. We will have not some of the right products (Like) or will be a lot of extra (Fulltext, Combine) in the search results.

A very important advantage of Magento search is the ability to filter and sort the results as well as working with a simple collection of products.

In the end, standard search Magento has following pluses:

  • native support for filtering
  • native support for sorting
  • acceptable speed (for search autocomplete response time is too large)

The downside, we believe that if store has big size of catalog the relevance of search would be bad.

For our projects, we have developed our own search module, which uses a search engine Sphinx.

  • Advantages Sphinx server we will not describe in detail. Key of them are:
  • Great speed of reindex (important if quantity of products over 50 000)
  • Support of the morphology of different languages
  • and most impressive – a broad search query syntax

The general procedure for the search string:

  • The user enters a search phrase
  • We are looking for this phrase in already executed queries. If there is a result, then we immediately return a collection of product IDs.
  • Otherwise we transform search query.
  • Send request  and receive a result from the Sphinx server
  • Store the result with its relevance to the database

It is worth mentioning that the Sphinx server request is processed in a fraction of a second. In real project with catalog of 60,000 products, from 10,000 search queries only 12 queries were executed more than 0.05 seconds.

Key advantages of Magento Sphinx Search:

  • Improved mechanisms of ranking and sorting of results
  • Support of the morphology of different languages
Oleksandr Drok

Head of Products at Mirasvit

Alex serves as the Head of Products at Mirasvit, where he formulates the vision for Mirasvit's extensions, carefully curates new features, and constructs the roadmap.
Related Products
Advanced Sphinx Search Pro

Advanced Sphinx Search Pro replaces the default search with the Sphinx-powered search. Therefore, the search works faster and search results are much more relevant. Using a Sphinx search engine increases conversion of visitors who look up the product on the website by more than 50%!

Sphinx Search Ultimate

Sphinx Search Ultimate is a Magento extension that combines the most modern approaches to the product search for online stores. Here you'll find all you need in order to create an ideal product search in your online store.

Loading...