In today’s article, we will explore a high-level overview of the brain behind the SAP Commerce Cloud search, the Solr Search engine. Apache Solr has been integrated as a core part of SAP Commerce since the early versions of SAP Hybris and stands out as a pivotal component in e-commerce search and navigation.

Solr is a robust search platform that simplifies data retrieval and enhances user experience through efficient and accurate search functionalities. This comprehensive article delves into the intricacies of Apache Solr, highlighting its features, operational dynamics, comparison with Elasticsearch, and tailored deployment in SAP Commerce Cloud.

What is Apache Solr?

Solr is a platform that can be understood as a database, used for specific purposes, and optimized for some operations, which makes it different from a traditional storage system. Unlike other databases, it’s intensely focused on a single type or item, the product item in the SAP Commerce scenario. Apache Solr is an enterprise-grade, open-source search platform from the Apache Lucene project. Its versatility in handling large datasets makes it a preferred choice for businesses needing advanced search capabilities. Simply put, Solr can be understood as a non-relational database or a NoSQL DB.

apache solr logo transparent

Relational vs Non-Relational Database

Understanding the distinction between relational and non-relational databases is crucial when exploring Solr’s capabilities. Relational databases, structured in tables and rows, excel in maintaining data integrity and complex querying through SQL. In contrast, Solr, embracing the NoSQL approach, offers more flexibility in data management, allowing for unstructured data indexing and searching. This flexibility is particularly beneficial in e-commerce scenarios where varied and complex product information needs to be indexed and retrieved efficiently.

Solr’s architecture enables it to manage diverse content types, from structured data to unstructured text, thus providing a comprehensive search experience. It uses an inverted index mechanism, making it highly efficient in searching and retrieving data quickly, even from vast datasets. On the other hand, writing to Solr is much more expensive than writing in a relational database.

sample relational database

Faceted Search

Faceted search, a standout feature of Solr, allows users to navigate a website’s products by applying multiple filters. These filters, or facets, categorize the information into various dimensions, such as price, brand, or category, enabling users to refine their search results systematically.

In the context of SAP Commerce Cloud, faceted search transforms the shopping experience. It lets customers drill down into product categories, filter search results based on specific attributes, and compare products side by side. This feature enhances the user interface and streamlines the path to purchase, significantly improving customer satisfaction and conversion rates.

Solr vs Elasticsearch

Solr is one of the most popular NoSQL databases on the market, with Elasticsearch being another giant in the sector. Both platforms cover most of the NoSQL DB market nowadays. Other players in the market are pushing hard, such as Algolia, Splunk, Sphinx, or platforms backed by sector giants such as Microsoft Azure Search, Google Search Appliance, or Amazon CloudSearch.

Which one is better for your project, Solr or Elasticsearch? While both platforms are powerful search engines based on Lucene, their approaches and functionalities cater to different requirements.

logo elasticsearch transparent

Performance

Solr is renowned for its robust performance and scalability, particularly in handling extensive search queries. It can manage sizable indexes efficiently, making it ideal for enterprise-level search applications like SAP Commerce Cloud. Elasticsearch, on the other hand, is designed with real-time search and analytics in mind, offering rapid data processing and an efficient way to handle streaming data.

Features and Flexibility

Solr provides a wide range of features out of the box, including advanced text search, faceted navigation, and rich document handling. Its flexible nature allows for extensive customization to meet specific business needs. Elasticsearch boasts a distributed nature, making it more scalable and accessible to integrate into microservices architectures. Its strong points are handling complex analytical queries and quickly aggregating large volumes of data.

In the SAP Commerce Cloud environment, essential Solr leverage is relatively simple, allowing for backoffice configurations that will tweak the search parameters of your sites. However, if your needs go beyond these basic configurations, you can always contact a SAP Commerce Solr implementation partner to do the project’s heavy lifting on your behalf.

How does the Solr Server work?

Solr runs on its own independent server, which allows for further scalability and performance. The platform’s clustering strategies will enable it to perform very well based on the expected load and will also expose the Solr content to other applications if desired. The process for installing Solr will vary depending on the commerce infrastructure, whether it’s hosted on-premise or in the cloud, whether it’s the SAP Cloud or AWS. However, being an open-source project, it allows for standard setup tools such as docker if the infrastructure allows it.

At the heart of Solr’s functionality is its ability to process and index vast amounts of data, making it accessible and searchable in near real-time. This is behind your commerce solution when searching for products, navigating through categories and filtering by facets, or the typical suggestion boxes as you type in the search bars. Let’s look at the different files and items on our search platform.

Solr Server console
Solr Server Console

Main Files

  • Solr.xml. This is the central configuration file for a Solr instance, defining the global properties of the Solr server and how it interacts with different cores (indexes).
  • Core.properties. This file specifies each core’s essential properties, such as its name and configuration settings. Each core acts as an independent search engine within the Solr instance.
  • Solrconfig.xml. It contains settings for the operation of a Solr core, including indexing and query processing configurations, defining request handlers, and setting up listeners and other core-related configurations.
  • Managed-schema. The managed-schema file defines the schema of a Solr core, including the fields and field types that can exist within the indexed documents. It’s a critical component that determines how Solr interprets and queries the data.

Main Items

  • Index. An index in Solr is a highly optimized database for search queries. It stores information about the documents to facilitate fast and accurate search results.
  • Document. In Solr, a document is a basic unit of information that can be indexed and searched. It is akin to a relational database record comprising multiple fields that store the data. In SAP Commerce OOTB, each findable product from the website is represented as a document in Solr.
  • Field. Fields are the elements within a Solr document, similar to columns in a database table. Each field has a defined type and set of properties dictating how the information is handled during indexing and querying. In our hybris example, name or description are fields within the Product document.

Querying Solr

Solr’s querying capabilities are robust, allowing for various complex search operations. It supports standard search queries, faceted searches, spatial searches, and more, providing a versatile toolkit for accessing indexed data.

The query process in Solr is highly optimized, leveraging the inverted index to locate information quickly. This makes it possible to perform real-time searches across extensive datasets, a critical feature for dynamic e-commerce environments like SAP Commerce Cloud, where quick access to product information is essential for user experience and business performance.

Advanced Query Features

Solr supports many query types, from simple keyword searches to more complex queries involving filters, boolean operations, and wildcards. This flexibility allows developers to build intuitive search interfaces that handle varied user requirements, from straightforward product lookups to detailed, attribute-based filtering.

Moreover, Solr’s rich query syntax supports proximity searches, fuzzy matching, and synonym expansion, enhancing the search’s accuracy and relevance. These features ensure that users receive the most pertinent results, even with partial or misspelled queries, improving the overall search experience.

sample db query

Real-Time Indexing and Search

Solr’s ability to index documents in real time and make them immediately searchable is a critical asset for e-commerce platforms. This feature ensures that the latest product information, pricing updates, and inventory changes are promptly reflected in the search results, enabling businesses to provide up-to-date information to their customers and ensure no outdated information is shown to customers.

Solr in SAP Commerce Cloud (hybris)

In SAP Commerce Cloud out-of-the-box, Solr plays a pivotal role in managing product search and navigation features, proving to be a powerful tool for driving sales and improving customer engagement. To easily connect to SAP Commerce, a Java-based platform, a connector based on SolrJ for Java is embedded in SAP commerce natively.

Checkers Facets

Integration with Commerce Functions

Solr’s integration within SAP Commerce Cloud extends beyond basic search capabilities. It underpins the platform’s e-commerce search experience, including navigation, merchandising, and personalized content delivery. By leveraging Solr, SAP Commerce can offer sophisticated search features like auto-suggestion, spell correction, and custom sorting, which are essential for a seamless shopping experience.

Apache Solr is used in SAP Commerce’s storefronts and web services in its standard version with the SAP Commerce accelerators. Still, it also provides a valuable tool for product managers and enrichers due to its influential position as the search engine for the SAP Commerce backoffice. This Solr Product Index allows hybris backoffice users to navigate and filter products, ensuring the product curation process is as effective as possible.

Managing Product Data

In SAP Commerce, Solr indexes a wide array of product data, including names, descriptions, specifications, and prices. This comprehensive indexing allows for a highly effective search process, enabling customers to find products swiftly through various attributes and criteria.

Furthermore, Solr’s faceted search capability is meticulously utilized in SAP Commerce to allow customers to filter products based on multiple dimensions such as category, brand, price range, and customer reviews. This multifaceted approach to search and navigation significantly enhances the user’s ability to find and compare products, leading to better decision-making and improved satisfaction.

Performance and Scalability

In the context of SAP Commerce Cloud, Solr’s architecture ensures that search functions scale effectively with the business’s growth. Solr’s distributed nature allows for scaling out to multiple servers to handle increased traffic and data volume, ensuring consistent search performance even during peak times. This scalability is crucial for large e-commerce platforms that experience fluctuating traffic and continuously expanding product catalogs.

SAP Commerce also provides different indexing jobs configurable via ImpEx, making its configuration simple and development-free. This allows the platform to fully index all the desired products in the desired Solr core and run high-frequency delta indexing jobs, ensuring that the index is up to date at all times with minimal effort.

solr product results from sap commerce backoffice
Product results in the SAP Commerce Cloud backoffice are sourced from Apache Solr.

Conclusion

Within the SAP Commerce Cloud environment, Apache Solr is a cornerstone technology, driving the e-commerce platform’s search and navigational capabilities. Its robust architecture, advanced search functionalities, and seamless integration with SAP Commerce ensure a superior search experience that can significantly impact the success of online retail operations.

By understanding and leveraging the power of Solr, businesses can enhance their e-commerce platforms, delivering fast, accurate, and relevant search results that meet the dynamic needs of modern consumers. In an era where quick and efficient access to information is paramount, Solr’s role in SAP Commerce Cloud becomes not just beneficial but essential for competitive advantage and customer satisfaction. As usual, you can contact us if you need a hand with your hybris project or have a look at E-Turia’s SAP Commerce Services:

SAP hybris Development Services
Contact Us