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 -

Request

Parameters:

Name

DataType

Description

Name

DataType

Description

ClientGuid

Alphanumeric String

The Client id/Tracking Key found in Admin > Account Info

Keyword

Alphanumeric String

Keyword entered by the user

BoostQueries

Array

Collection of boosting objects

>query

Alphanumeric string

The field(s) and value(s) to be searched for

>boost

Integer

The 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 - ):

  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 } ] }