Search Suggestion for Developers

You can add more complex search completion support to your application via the Salesforce B2C Commerce APIs. Before you begin coding, review the SiteGenesis application to see how this feature was implemented.

SiteGenesis Implementation

Review these SiteGensis files to understand how this feature was implemented, for example:

When you implement this feature, you need to consider the performance impact. The SiteGenesis implementation shows suggestions as a popup immediately after the customer starts entering text in the search field. The popup's HTML content is fetched using an asynchronous AJAX call. The SiteGenesis application executes the AJAX calls in a gracefully way as follows:

Using the B2C Commerce APIs

Use the B2C Commerce APIs to customize your code. The Suggest API consists of the following:

See the B2C Commerce APIs for more information.

Match Types

Matches are defined as follows:

Match Type Ranking Priority Description
Exact 1 The original and suggested terms are exactly equal
Auto completion 2 The original is a prefix of the suggested term.
Fuzzy 3 The original and suggested terms differ by a few characters, similar to spell correction
Note: The match types and ranking described here is only applicable for suggested terms, that is, auto completion and auto correction. It does not affect any search results or sorting rules.