How to Configure Magento 2 Solr Extension?

How to Configure Magento 2 Solr Extension?

Want to reduce search-related database load by 80%? Magento 2 Solr extension offers a high-speed alternative by offloading search queries from MySQL to Apache Solr.

This tutorial will explore the working, prerequisites, and configuration steps of the Magento 2 Solr extension.

Best Magento Hosting now

Key Takeaways

  • Solr extension boosts search speed and reduces database load.

  • Real-time indexing keeps search results up to date.

  • Advanced ranking algorithms improve search relevance.

  • Easy integration with Magento 2 ensures a smooth search experience.

  • Switch from MySQL search to Solr to enhance speed and accuracy.

What is Magento 2 Solr Extension?

The Magento 2 Solr extension integrates Apache Solr, a high-speed search platform, into Magento 2, replacing the default MySQL search.

The module enhances search performance by delivering faster, more accurate results through:

  • Faceted navigation

  • Fuzzy search

  • Autocomplete

  • Relevance ranking

Solr efficiently handles large catalogs. It helps reduce database load and improve scalability. Real-time indexing and multilingual support ensure a smooth user experience. Popular extensions optimize search queries for better conversions.

The extension helps Magento stores achieve faster searches and improved accuracy. It also enhances customer satisfaction and boosts overall store performance.

How Does Magento 2 Solr Extension Work?

1. Data Indexing in Solr

  • Magento sends product data to Solr for indexing. These data include:

    1. Titles

    2. Descriptions

    3. Attributes

    4. SKUs

  • Solr organizes the data using schema-based indexing. It also optimizes it for fast search queries.

  • The index is updated in real time whenever products are added or deleted.

2. Processing Search Queries

  • When a customer enters a search term, Magento sends the query to Solr instead of MySQL.

  • Solr quickly processes the request and retrieves highly relevant search results. It is based on various ranking factors.

  • It offers features like fuzzy search and spell correction that refine the results.

3. Delivering Optimized Search Results

  • Solr ranks results based on relevance. It uses algorithms that consider:

    1. Keywords

    2. Product Popularity

    3. User behavior

  • Customers get instant, accurate search results. It reduces bounce rates and improves conversions.

  • Faceted navigation allows filtering by attributes like category and ratings.

4. Performance Optimization & Scalability

  • Solr reduces database load by handling search queries separately from Magento’s MySQL database.

  • It can manage millions of products with a distributed architecture. It is ideal for high-traffic stores.

  • Caching and load balancing improve response times. It ensures a smooth search experience.

17 Technical Prerequisites of Magento 2 Solr Extensions

Technical Prerequisites Explanation
1. Operating System Linux-based OS, including Ubuntu and Debian, is preferred. It provides Solr with better stability and security. Windows Servers can also be used, but additional configuration may be required.
2. Web Server Apache 2.4+ or Nginx 1.18+ is required for proper compatibility with Magento 2. Ensure proper configuration of virtual hosts or proxy settings for Solr integration.
3. PHP Version Magento 2.4.x requires PHP 7.4 or PHP 8.1 versions. PHP 8.2 support varies based on the Solr extension. Magento 2.3.x requires PHP 7.3 or PHP 7.4 versions. The required PHP extensions include ext-curl, ext-mbstring, ext-dom, ext-intl, ext-json, ext-opcache.
4. Database Requirements MySQL 8.0 or MariaDB 10.4+ are required. Proper indexing should be enabled to minimize database load. It ensures Solr handles search queries instead of MySQL.
5. Memory & CPU Recommendations Minimum 2 CPU cores, recommended 4+ CPU cores for large stores. Minimum 4GB RAM; recommended 8GB+ for better search performance. Dedicated SSD storage for better indexing speed.
6. Solr Version Compatibility Magento 2 requires Solr 7.x or 8.x. Some extensions may require Solr 8.6+ for advanced features. These include auto-suggestions and fuzzy search.
7. Java Runtime Environment Solr runs on Java, so OpenJDK 11 or higher is required. Check the Java version. If Java is missing, install OpenJDK.
8. Installing Solr Download the latest Solr version from Apache Solr's official website. Verify the Solr instance by accessing *http://your-server-ip:8983/* in the browser.
9. Solr Port Configuration Default Solr runs on port 8983, which should be open in the firewall. If using Solr in a multi-server setup, configure SolrCloud for distributed indexing.
10. Installing Magento 2 Solr Extension Install the extension via Composer or Magento Marketplace. Ensure Solr is properly configured and is reachable from Magento.
11. Updating env.php Configuration Add Solr connection details in app/etc/env.php. Run reindexing.
12. Faceted Search & Indexing Configuration Ensure real-time indexing is enabled. Enable faceted navigation in Magento for filter-based search.
13. Performance Enhancements Use Redis or Varnish to speed up query execution. Enable stop words and synonym matching in Solr’s schema. Optimize Solr's commit strategy to reduce indexing overhead.
14. Security Considerations Restrict Solr admin panel access with IP whitelisting or basic authentication. Use SSL/TLS encryption for Solr queries if running in production.
15. Backup & Disaster Recovery Automate Solr backups to avoid data loss. Monitor Solr logs to detect indexing or performance issues.
16. Load Balancing for High Traffic Stores Deploy SolrCloud for distributed indexing and fault tolerance. Use multiple Solr nodes with a load balancer to handle concurrent search requests.
17. Solr Port & Firewall Rules Ensure port 8983 is open. Restrict external access with IP filtering.

Difference Between MySQL Search and Solr

1. Performance & Speed

Feature MySQL Search Solr
1. Query Execution It is slower. This is especially true with large product catalogs. It is much faster due to optimized indexing.
2. Database Load It increases database queries. It leads to slow performance. It offloads search processing from MySQL.
3. Indexing Speed It offers slower indexing for new products. It offers faster, real-time indexing with incremental updates.
4. Handling Large Data It struggles with more than 100K products. It efficiently manages millions of records.

Solr offers faster search execution and better handling of large product catalogs.

2. Search Accuracy & Relevance

Feature MySQL Search Solr
1. Full-text Search It offers basic search. It is limited to exact matches. It supports fuzzy search and synonyms.
2. Relevance Ranking It includes no advanced ranking system. It includes a weighted scoring system for better accuracy.
3. Auto-suggestions It offers limited capabilities. It offers smart auto-complete and spell correction.
4. Faceted Search It requires complex queries. It offers native support for filters and faceted navigation.

Solr offers more intelligent search capabilities for a better user experience.

3. Customization & Advanced Features

Feature MySQL Search Solr
1. Custom Query Handling It offers basic SQL queries. It supports advanced search algorithms.
2. Multilingual Support The support is limited. It supports multiple languages and stemming.
3. Stop Words & Synonyms Manual configuration is required. It offers built-in support.
4. AI & Machine Learning It is not available. It supports AI-driven ranking models.

Solr offers more flexible and powerful customization options.

4. Installation & Maintenance

Feature MySQL Search Solr
1. Default Magento Compatibility It offers built-in Magento compatibility. It requires additional setup for Magento compatibility.
2. Setup Complexity No extra setup is needed. It requires Solr installation and Magento configuration
3. Maintenance Maintenance is simple. It requires monitoring and tuning.

MySQL offers an easier setup for small stores, but Solr is worth the effort for large stores.

10 Steps to Configure Solr for Magento 2

1. Log in to the Magento Admin Panel with the required credentials.

2. Navigate to System → Configuration.

Steps to Configure Solr for Magento 2-2

3. Under the Catalog section, select Catalog Search.

Steps to Configure Solr for Magento 2-3-1

4. choose Solr from the dropdown menu in the Search Engine field.

Steps to Configure Solr for Magento 2-3-2

5. Enter your server’s IP address in the Solr Server Hostname field.

6. Set the Solr Server Port to 8983.

Steps to Configure Solr for Magento 2-5

7. Specify solr as the Solr Server Path.

8. Click the Test Connection button. If it turns green, the connection is successful.

9. Click Save Config to apply the changes.

10. If necessary, go to System → Index Management and update the indices.

Steps to Configure Solr for Magento 2

FAQs

1. How does the Magento 2 Solr Extension improve search performance?

It uses Apache Solr’s powerful indexing to deliver lightning-fast search results. Features like faceted search and typo tolerance enhance customer experience.

2. Is the Magento 2 Solr Extension compatible with multi-store setups?

It supports multi-store environments, allowing each store to have customized search settings. You can configure Solr to handle different languages and indexing rules per store.

3. Does the extension support real-time indexing?

It ensures that product updates are indexed instantly, keeping search results up-to-date. This is essential for large catalogs and frequently changing inventories.

4. Can Magento 2 Solr Extension handle high search traffic?

Solr is designed for scalability and can manage thousands of queries per second. It helps optimize search performance even during peak shopping seasons.

CTA

Summary

Magento 2 Solr extension replaces the default MySQL search for faster and more accurate results. The article explores the benefits of the extension, including:

  • Solr processes search queries faster, offering real-time indexing and multilingual support.

  • Features like fuzzy search and AI-driven ranking improve search results.

  • Solr handles millions of products, reducing database strain and supporting distributed architecture.

  • Requires installation and regular monitoring but offers significant advantages for large stores.

Boost your store’s search performance with the Magento 2 Solr extension. Pair it with managed Magento hosting for better scalability and optimized performance.

Ruby Agarwal
Ruby Agarwal
Technical Writer

Ruby is an experienced technical writer sharing well-researched Magento hosting insights. She likes to combine unique technical and marketing knowledge in her content.


Get the fastest Magento Hosting! Get Started