3 Steps to Configure Magento 2 Sphinx Search for Stores

3 Steps to Configure Magento 2 Sphinx Search for Stores

Looking to enhance your eCommerce store's search functionality? Magento 2 Sphinx is a clever solution that enhances the default search capabilities of ecommerce stores.

In this tutorial, we will explain how to configure Sphinx search extensions and its best practices.

Key Takeaways

  • Increase your store’s search speed with efficient indexing.

  • Improve product visibility with advanced search features.

  • Enhance search results with custom relevance ranking.

  • Address common search issues like typos and misspellings.

  • Optimize your store's search performance with tailored configurations.

What is Sphinx Search Engine?

Definition of Magento 2 sphinx

Sphinx Search for Magento 2 is an advanced search engine designed to enhance product search on eCommerce platforms. Sphinx is known for its exceptional search speed. It can process over 500 queries per second against a catalog of 1 million SKUs. It allows for both batch indexing and real-time searching of data stored in SQL databases.

Sphinx Search operates by indexing the content on a Magento 2 website. It involves creating a list of product attributes, such as titles, descriptions, and prices. The indexing process is continuous. It ensures that any updates, like new products, are quickly reflected in the search results. When a user enters a search query, Sphinx sorts through this indexed data to deliver the most relevant results.

Key Features of Magento 2 Sphinx Search

1. Advanced Full-Text Speech

Full text speech feature in Magento 2 sphinx

  • Advanced full-text search is a cornerstone of Sphinx Search. It goes beyond simple keyword matching. This feature allows for complex queries and precise results. Here's a breakdown of its key components:

    1. Wildcard searches: Users can use wildcards in their queries. An asterisk () represents any number of characters. A question mark (?) represents a single character. For example, "shirt" could match "shirts," "shirting," etc. It helps users find products even with partial information.

    2. Phrase matching: Users can search for exact phrases. Quotation marks denote phrases. "Blue denim jacket" will only return items with that exact phrase. It is useful for specific product searches.

    3. Proximity searches: This allows searching for words within a certain distance of each other. It's useful for finding related terms. For example, "cotton ~5 shirt" finds "cotton shirt" and "shirt made of cotton."

    4. Boosting: Certain terms in a query can be given more importance. Adding a caret (^) boosts a term's relevance. "shirt^2 blue" makes "shirt" twice as important as "blue" in the search.

2. Custom Relevance Ranking

  • Custom relevance ranking is a powerful navigation feature. It determines how search options are ordered.

  • Sphinx allows multiple ranking criteria. These can include text relevance, popularity, and custom attributes. Each factor can be weighted differently. It creates a tailored ranking algorithm.

  • Sphinx can adjust rankings based on user behavior. If users frequently click on the fourth or fifth result for a particular query, Sphinx can learn from this and adjust future rankings accordingly.

  • Sales data can influence rankings. Best-selling products can be boosted in search results. It can lead to increased conversion rates while capitalizing on social proof.

  • Specific product attributes can impact ranking. For example, "new arrivals" or "on-sale" items can be boosted. It allows for strategic product promotion.

  • Newer products can be given higher relevance. It keeps search results fresh and current. It's particularly useful for fashion or technology stores.

3. Spell-check and "Did you mean?" Functionality

Spell check feature in Magento 2 sphinx

  • It addresses a common user problem: typos and misspellings. This functionality improves the search experience significantly. It helps users find products even when they make mistakes.

  • Sphinx checks spelling as users type. It compares input against a dictionary. This dictionary is often based on the store's product catalog.

  • When a misspelling is detected, alternatives are suggested. These suggestions appear in real time. They're often displayed below the search bar.

  • If no results match the misspelled term, a prompt appears. It suggests the correct spelling. Users can click this to run a new search.

  • Some implementations use phonetic algorithms. These catch misspellings based on how words sound. It's useful for handling names or complex terms.

4. Customizable Search Results

  • Customizable search results are a powerful tool for developers. This feature allows for a tailored presentation of search outcomes. It goes beyond basic product listings. Here's a detailed look at what this feature offers:

    1. Flexible result templates: Developers can create custom HTML templates. These define how each search result appears. Templates can be product-specific or category-specific.

    2. Highlighting matching terms: Matching keywords are visually emphasized. It is often done with bold text or background colors. It helps users quickly see why a result is relevant.

    3. Snippet generation: Relevant text snippets can be displayed. These show the context of matching terms. Snippets are dynamically generated from product descriptions.

    4. Custom field display: Any product attribute can be shown in the results. It includes standard fields like price and custom attributes. Developers choose which fields to display.

    5. Infinite scroll: Developers can choose how additional results load. Options include "Load More" buttons or infinite scroll. It affects how users browse through many results.

Steps to Configure the Magento 2 Sphinx Search Extension

Step 1: Modify General Settings

  1. Log in to the Magento admin panel after installing the Magento 2 extension.
  2. Navigate to Stores > Configuration > Sphinx search.

Magento 2 Sphinx extension configuration

  1. Select the Built-in search engine option.
  2. Enable the wild card search for users and redirect from 404.
  3. Select Yes to display search-related items.

Search engine configuration in Magento 2 Sphinx

  1. Choose Sphinx from the Search Engine option.
  2. Enter the host and port number and check the status.

Step 2: Configure Autocomplete Search settings

Autocomplete search settings in Magento 2 sphinx extension

  1. Enter the minimum number of characters to autocomplete.

  2. Enter a delay time before the autocomplete search begins.

  3. Enable the pages of your store to be indexed and the number of search results allowed.

Step 3: View analytics and reports

Analytics in Magento 2 sphinx extension

  1. Navigate to System and view the search analytics.

search terms in Magento 2 sphinx extension

  1. View the search terms used by customers and their engagement.

Search index settings in Magento 2 sphinx extension

  1. Click Search Indexes to view the category pages ranking on the search menu.

Score boost rules page in Magento 2 sphinx extension

  1. Select the Score Boost Rules options to set up rules for recommendations.

Sphinx Search vs. Elasticsearch: Features Comparison

Feature Sphinx Search Elasticsearch
Architecture SQL-based full-text search engine Distributed, RESTful search and analytics engine
Language Written in C++ Written in Java
Data Storage Primarily designed for external data sources (e.g., SQL databases) Can store and index data directly
Scalability Limited horizontal scalability Highly scalable, designed for distributed environments
Real-time Indexing Supports near real-time indexing Native real-time indexing and searching
Query Language SphinxQL (SQL-like) Query DSL (JSON-based)
Full-text Search Strong full-text search capabilities Advanced full-text search with analyzers and tokenizers
Faceted Search Supported, but less flexible Highly flexible and powerful faceted search
Geospatial Search Basic support Advanced geospatial query capabilities
Aggregations Limited aggregation capabilities Powerful and flexible aggregations
Machine Learning Not built-in Integrated machine learning capabilities
Schema Fixed schema Schema-free (dynamic mapping)
Performance Very fast for specific use cases High performance for various scenarios
Memory Usage Generally lower memory footprint It can be memory-intensive for large datasets
Community & Ecosystem Smaller community, fewer plugins Large, active community with many plugins and integrations
Visualization No built-in visualization tools Kibana for data visualization and dashboards
Use Cases Ideal for simple, high-performance, full-text search Suitable for complex search and analytics scenarios
Language Support Limited built-in language analysis Extensive language analysis capabilities
Distributed Search Limited distributed capabilities Native support for distributed search and sharding
Updates & Maintenance Less frequent updates Regular updates and active development

Top 3 Magento 2 Sphinx Search Extensions

Extension Key Features
Mirasvit Sphinx Search Ultimate - Ultra-fast search (500+ queries/sec against 1M SKUs)
- Autocomplete and spell correction
- Synonyms and stopwords support
- Customizable search results ranking
- Multi-language support
- Faceted/layered navigation
Sphinx Search Extension by Amasty - Lightning-fast indexing and searching
- Advanced keyword matching
- Typo tolerance and autocorrection
- Customizable search results display
- Search across various content types
- Flexible management options
MageWorx Sphinx Search - Seamless Sphinx integration
- Customizable Sphinx settings
- Search results ranker
- Autocomplete functionality
- Multi-store support
- Flexible search delay and field configuration

Best Practices for Magento 2 Sphinx Search Integration

1. Configure Search Attributes Carefully

  • Search attributes are the product details the Sphinx module uses. They determine what's searchable. It affects search speed and accuracy.

  • Select attributes that customers use to find products. Common choices include product name, SKU, and description. Only include some possible attributes. Too many can slow down searches.

  • Assign importance to each attribute. It is done with numerical weights. Higher numbers mean more importance. For example:

    1. Product Name: Weight 10

    2. SKU: Weight 8

    3. Short Description: Weight 6

    4. Full Description: Weight 4

  • This setup ensures product names appear first in results.

  • Stopwords are common words ignored in searches. Examples include "the," "and," and "in." Create a list of stopwords for your store. It helps focus on meaningful terms and speeds up searches.

2. Optimize Search Results Display

  • A clean layout helps users find products quickly and reduces distractions. Here are the key elements:

    1. Easy-to-read text: Choose legible fonts and sizes.

    2. Whitespace: Use ample spacing between products.

    3. Grid view option: Allow users to switch between list and grid views.

    4. Responsive design: Ensure the layout works well on all devices.

  • Faceted search lets users refine results easily. It's like adding filters to a search. Common facets include:

    1. Price range

    2. Brand

    3. Size

    4. Color

    5. Customer rating

    6. Product Features

  • Show key details in search results. It helps users make decisions quickly. Important information includes:

    1. Price: Display clearly, including any discounts.

    2. Availability: Show if the item is in stock.

    3. Ratings: Use star ratings for quick quality assessment.

    4. Free shipping badge: If applicable, highlight free shipping.

    5. Sale or discount indicator: Use eye-catching tags for deals.

    6. Quick view option: Let users see more details without leaving the page.

    7. Add to cart button: Enable direct purchase from results.

3. Analyze Search Performance

Analyze search performance in the Magento 2 sphinx extension

  • Search logs show what customers are looking for. They're a goldmine of information. Here's how to use them:

    1. Check daily: Look at logs every day.

    2. Find patterns: Note repeated searches.

    3. Spot misspellings: See common typos customers make.

    4. Identify trending items: Notice sudden spikes in certain searches.

  • "Zero results" means a search found nothing. It's frustrating for customers. Here's how to fix it:

    1. List common failed searches: Keep a record of searches that yield no results.

    2. Check for misspellings: Add common misspellings to your search index.

    3. Use synonyms: Link-related terms (e.g., "couch" and "sofa").

    4. Expand your catalog: Consider stocking items people search for.

    5. Create custom landing pages: Make pages for common searches you can't fulfill.

  • Search patterns change with seasons. Staying ahead helps inventory planning. Here's how:

    1. Compare year-over-year: Look at search trends from the same time last year.

    2. Note early indicators: Spot rising trends before they peak.

    3. Plan content: Prepare landing pages for predicted popular searches.

  • For example, searches for "Halloween costumes" start rising in late August. You can prepare by updating your Halloween category page early.

4. Optimize Indexing

  • Scheduling indexing during off-peak hours: Indexing is a resource-intensive process. It can slow down your website if done when many customers are shopping. To avoid this, schedule indexing when your site is least busy.

  • Using incremental indexing: Incremental indexing updates only the products that have changed since the last index. It is faster and less resource-intensive than rebuilding the entire index.

  • Imagine you have an online bookstore with 100,000 books. Today, you added 50 new books and updated the prices of 100 existing books. Instead of reindexing all 100,000 books, incremental indexing would only process the 150 books that changed. It might take a few minutes compared to hours for a full reindex.

  • Handling large catalogs: For very large product catalogs, consider breaking the indexing process into smaller chunks.

  • If you have 1 million products, you might create ten indexes of 100,000 products each. You could update one index each hour, cycling through all products every 10 hours. It spreads the indexing load and ensures that every indexing job takes only a little bit of time.

FAQs

1. What is Magento Sphinx Search, and how does it differ from the default Magento search?

Magento Sphinx Search is an advanced search extension. It enhances the default Magento search functionality by providing faster and more relevant search results. Unlike the default, Magento 2 search module, Sphinx Search offers search spell correction, layered navigation, and long-tail search capabilities. It improves the user experience significantly.

2. How can I configure the Sphinx engine in my Magento 2 store?

To configure the Sphinx engine in your Magento 2 store, navigate to the Sphinx configuration settings. It is in the Magento admin panel. You can then select the Sphinx Search as your search solution. Adjust the search relevance settings and enable features like search autocomplete and stop words. It is to ensure precise search results.

3. Can Sphinx Search Magento 2 be integrated with CMS pages and product options?

Yes, the Sphinx Search Magento 2 extension allows integration with CMS pages and product options. This integration helps customers find relevant content and products easily. It enhances the overall store search experience and helps to boost sales.

4. What are the benefits of using Sphinx Search over other search engines like Elasticsearch?

Sphinx Search offers a great search experience with lower memory usage and faster indexing. It makes it ideal for smaller stores or those in a Magento cloud environment. Elasticsearch is highly scalable and powerful for larger operations. Sphinx provides a more lightweight solution. It still delivers relevant search results and supports extended search functionalities.

5. How does the “search spell correction” feature work in Magento Sphinx Search?

The search spell correction feature in Magento Sphinx Search automatically corrects typos. It also suggests alternatives as users type in the search box. It ensures that customers find the products they are looking for. Even if they make spelling mistakes, it improves the search quality and user satisfaction.

CTA

Summary

The Magento 2 Sphinx integration enables store owners to understand how consumers search and buy products. In this tutorial, we explored how this search functionality works and its best practices. Here is a quick recap:

  • Magento 2 Advanced Search with Sphinx enhances search functionality for faster and more accurate results.

  • The integration with Sphinx provides a powerful and flexible search tool for Magento stores.

  • Sphinx is an open source search engine that delivers superior search functions compared to other search engines.

  • The Sphinx Magento 2 module improves the search mechanism to help customers find products effortlessly.

  • This extension works seamlessly with Magento 2 Enterprise, offering a robust search engine’s capabilities.

Optimize your store with managed Magento hosting and Sphinx search for better performance and product visibility.

Nanda Kishore
Nanda Kishore
Technical Writer

Nanda Kishore is an experienced technical writer with a deep understanding of Magento ecommerce. His clear explanations on technological topics help readers to navigate through the industry.


Get the fastest Magento Hosting! Get Started