Integration methods
Sitecore Search provides the following integration methods that you can choose from:
-
Sitecore Cloud SDK - if your organization has a JSS Next.js or a JSS Angular application connected to Sitecore XM Cloud, implement Sitecore Search-related functionality on your XM Cloud site using the Sitecore Cloud SDK. See also a comparison of the Cloud SDK and the Sitecore Search REST APIs.
-
JavaScript SDK for React - integration involves adding SDK packages containing components and features to your project. Built specially for React applications, the SDK is the fastest way to integrate with Search and requires the least time and development effort.
-
JavaScript Data package - can be used with vanilla JavaScript or in any JS framework. This is quick way to make search queries and receive responses from Search.
-
REST APIs - integration involves accessing endpoints that expose Search services. Configure the requests you want to send to Search. You'll also need to handle the responses and translate them into Search experiences.
The JavaScript SDK sets a cookie and includes the UUID when tracking events. Visitor information, UUID, is required to personalize search results.
Compared to the SDKs, API integration usually takes longer and requires more development effort but provides complete flexibility.
Before integration
Before integration, an administrator configures your domain. They add attributes, index content, set up features, and configure widgets. They do all of this to prepare your domain for integration.
Before you integrate, at a minimum, make sure that you:
-
Can access Sitecore Search, a SaaS workbench where you can test requests and monitor events. You also use Sitecore Search to view attributes, features, and widgets configured for your domain and get details like their names and IDs.
-
Have access to API keys with required scopes. You need this for authentication if an administrator has not set up a subdomain.
-
Know where to show a search results widget and where to show a preview search widget. For example, you might want to show a full-page search on your company's home page but only a preview search for each vertical.
-
Know which features, like facets, sorting, and others, are required for each search experience and how these features are configured.
NoteWhile an administrator configures most features in Search, you might need to pass some settings at runtime.
-
Know what content needs to be searchable in each search experience. This is because not all indexed content might need to be available for all searches.
If you have trouble getting any of this information, contact your administrator.
During integration
During integration, you add Search-specific code to your application or website. This code sends requests to Search and receives responses from it.
For example, if a visitor enters a term in the search bar and clicks enter, you'll want to show matching results. To get these results, send a request to Search to get content for a search widget. Search looks within your domain's indexed content, applies its algorithm, and returns search results. You'll also need to send events based on visitor actions.