Dynamic Query Boost Search

Hawksearch dashboard provides option to add and configure boost rules for all searches globally - however this feature affects all searches.

To boost some items based on certain criteria in real-time, we can apply the boost value to the query alone. This will ensure that the boost value is applied only to the query and not globally.

Use this feature for specific search keywords, visitor targets and more.

The URL endpoints are the same as the search api - Hawksearch v4.0 - Search API

Request

Parameters:

NameDataTypeDescription
ClientGuidAlphanumeric StringThe Client id/Tracking Key found in Admin > Account Info
KeywordAlphanumeric StringKeyword entered by the user
BoostQueriesArrayCollection of boosting objects
> queryAlphanumeric stringThe field(s) and value(s) to be searched for
> boostIntegerThe boost value for the particular filter provided by the query parameter

API request to enable query boosting:

  1. Specify the field name in the “query” parameter (details of the query parameter in here - Field-specific Search ):
  2. Specify both the query parameter and the boost value within the parameter BoostQueries

Example:

In this below example, out of all the results we obtain for the search term shirts, those which have tee in their name field will be boosted with value of 10000. Due to this, the items which have tee in their names will have higher precedence which implies that these items will be boosted to the top.

POST /api/v2/search  
{  
    "ClientGuid": "SPECIFY YOUR CLIENT GUID HERE",  
    "Keyword": "shirts",  
    "BoostQueries": [  
        {  
            "query": "name.text:tee",  
            "boost": 10000  
        }  
    ]  
}