In SAP Commerce Cloud, searching for items or objects is a crucial aspect of handling data efficiently. There are two primary approaches to accomplish this, each with unique advantages and use cases: Flexible search and Index-based Solr search.

- FlexibleSearch: This approach uses the FlexibleSearch language, similar to SQL but tailored specifically for the SAP Commerce platform. It always returns model objects as search results. FlexibleSearch queries allow users to perform complex searches across the database while using Cache. It is beneficial when detailed and customized search criteria are required. Based on FlexibleSearch, further search mechanisms are implemented, such as:
- Advanced Search: It uses Flexible Search queries, allowing users to define specific parameters and conditions to tailor the search results in Backoffice. Refer to the Advanced Search Widget page for more details.
- ViewType Search: It allows users to search data based on predefined views and offers an abstraction layer for querying data without requiring detailed knowledge of the underlying SQL or Flexible Search syntax. Refer to the Report Definitions (ViewTypes) page for more details.
- Generic Search: It focuses on providing a more generalized and type-safe search experience that can be parameterized and reused on the API level. However, Generic Search queries are always translated into flexible search queries during the execution. Refer to the GenericSearch page for more details.
- Index-based Solr Search: SAP Commerce Cloud uses Solr, a prepackaged and customized search engine, to deliver high-performance, full-text search capabilities.
Note
- Solr is an open-source, enterprise-grade search platform built on Apache Lucene. It is optimized for rapid and efficient search tasks, especially within large datasets. With Solr, search results are always returned as text rather than model objects, ensuring consistency and simplicity in data handling.
- The Solr-based search features facets, filtering, autosuggestions, and relevance ranking, which significantly enrich the overall search experience for users. It manages complex search scenarios adeptly, providing near real-time indexing and search functionalities crucial for dynamic e-commerce environments. These capabilities make Solr invaluable for maintaining high-performance search operations within SAP Commerce Cloud.
A quick sum-up: FlexibleSearch and Solr Search have distinct strengths, making them suitable for different use cases.
- FlexibleSearch excels in handling intricate and highly customized queries, making it ideal for tasks such as content loading on product details pages.
- On the other hand, Solr Search is optimized for performance and scalability, making it perfect for quick and comprehensive full-text searches, such as those needed on full-text search result pages or category pages.
These complementary approaches ensure that users can efficiently and effectively access the data they need, depending on the specific requirements of their use case.
FlexibleSearch has already been covered in our beginner-level learning journey. In this unit, we explore the features of the Solr-based search and learn how to configure and customize them.