HawkSearch for Salesforce B2B Lightning

 

Overview  

The Hawksearch solution enables online retailers and publishers the ability to drive a rich, compelling user experience.  This experience drives visitors to the products and information that they seeking.  With a robust set of tools and advanced machine learning and personalization components Hawksearch solution allows merchandisers, marketers and developers to customize the search experience on the site.  


There are two parts of the Hawksearch integration with Salesforce B2B Commerce:  

  • Extracting product and attribute data out of Salesforce B2B Commerce   

  • Front End Integration of the search page and autocomplete on Salesforce B2B Commerce  

For every Hawksearch customer there is an engine available on the Hawksearch side. Merchandisers and marketers log into the dashboard to manipulate rules for the search behavior and merchandising and control relevancy. The engine end-point is integrated with the front-end search page to deliver results to that page.

This document covers how Hawksearch integrates with Salesforce B2B Commerce. For additional details about the Hawksearch functionality, please access the link below  

 https://hawksearch.atlassian.net/wiki/spaces/HSKB   

 

Salesforce Bulk API Integration  

HawkSearch integration with Salesforce B2B Commerce (Lightning)

 

Hawksearch requires product, attribute and hierarchy data to build a search index and power search functionality on storefronts and websites.   

To extract the data from Salesforce Commerce we use the Bulk API version 2.0 Salesforce provides to access the:  

  • Product list data  

  • Category Data  

  • Product Attribute Data  

  

Once the app extracts data out of Salesforce Commerce, we build a search index that houses this data. Merchandisers, Marketers and developers can login to the Hawksearch dashboard to manipulate results order and scores using:  

  • Boost/Bury Rules  

  • Visibility Rules  

  • Item Pinning   

Merchandisers and marketers can also set up merchandising campaigns and banners from  

Hawksearch using various options available in the Hawksearch dashboard:

  • Content Items  

  • Spotlights  

  • Campaigns  

  • Redirect Rules  

  • Landing Pages  

 

  

To access the REST API the app follows the steps below:

  1. Obtain the authorization token using Salesforce Rest API
    Using post request https://login.salesforce.com/services/oauth2/token to end point with grant_type =  password  

  2. Use authorization token provided in step 1 token to get products and categories Salesfoce Bulk APIs.  

  3. The APP uses the Bulk API to create queries

    NOTE: Bulk API details for creating the app referenced from the wiki link below https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/queries.htm  

    URL:    /services/data/v49.0/jobs/query/queryJobId/  
    Method: POST 

    1 2 3 4 Parameters: {    "operation": "query",    "query": "SELECT  Name, Description, DefaultLanguage, SupportedLanguages FROM WebStore"  } 

     

  4. The APP uses the Bulk API to download the results to get product data  
    NOTE: Bulk API details for creating the app referenced from the wiki link below https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/queries.htm  

    URL:    /services/data/v49.0/jobs/query/queryJobId/results 
    Method: GET 
    Parameters: None 
     

The App downloads all data in batches using Locator parameter based on the previous result’s Sforce-Locator and Sforce-NumberOfRecords sent by the Bulk API. The APP makes multiple requests to fetch the product data from the REST API call.  

  

Front End Search Page Integration  

Hawksearch serves up the autocomplete and the search results data in JSON format on the Community storefront.  The APP currently uses the Hawksearch – API Integration method. 
For additional information about this method, please refer to the Knowledge Base article at the following location:

https://hawksearch.atlassian.net/wiki/pages/createpage.action?spaceKey=HSKB&title=API%20-%20Hawksearch%20v4.0   

Visit the storefront website on the browser:  

  

Type in the product you are looking for in the searchbox present on the top header bar: Product suggestions should start coming up as you type in and refine your keyword. This autocomplete feature of Hawksearch displays the top products containing the search term in addition to popular searches and categories.  The settings for autocomplete to display content, categories, products and more are available in the Hawksearch dashboard. 

Click on any of the items displayed in the autocomplete section to navigate directly to the item. Click on View All Results link at the bottom of the autocomplete or simply press the Return key to go to the search page.  

  

Use the Dropdown under Sort By to sort the items by Name in ascending or descending order. The default sorting is based on the best match algorithm.  

  

In case of more than 12 items, the first 12 items are displayed by default. This is also configurable from the Hawksearch dashboard. 

 

You can select filters from the left navigation to narrow results in your result set.