Search
Bloomreach
Currently Implemented Functionality:
Currently Implemented Functionality:
Suggestion Search
- getSearchSuggestions
- You can suggest products along with queries in your autosuggest API calls. When a visitor to your site begins typing a query, the autosuggest call retrieves a text-based list of queries as well as products. By default, the response includes a maximum of eight products.
- Input: String query
- Output: SearchSuggestionHits object
- Request Endpoint: /suggest
- Query parameters:
- q: query string
- request_type: suggest
Keyword Search
- searchForProducts
- The product search API sends a keyword query to retrieve results about products and other content on your site. You can apply additional filters and facets to return products and content that either include or exclude specified attributes like colors and brands.
- Input:
- initial: SearchParameters object
- params: SearchParameters object
- page: int
- pageSize: int
- Output: ProductSearchHits object
- Request
- Endpoint: /search
- Query parameters:
- request_type: search
- search_type: keyword
- fl: product_id (string)
- url: toolstation.com
- rows: pageSize
- start: page * pageSize
- q: initial query
- fq: category:"c${initial.taxonomy}" (if taxonomy is provided)
To be implemented:
- getBestSellerProductCodes
- getSiblingProductsInCategory
- getDepartments
- getCategories
Show In Stock Only
- The show in stock switch on the PLP shows in stock items only when on. In stock is defined as:
- Products returned by a Bloomreach query with the parameter &efq=available_stores:("Favourite Branch Code") added.
- The ECOM API /ecom/v1/stock/getStock end point is called with the list of product codes returned from Bloomreach and "sites": "WW", "Favourite Branch Code"
- Any Products that are out of stock in the ECOM API results are then removed from the Bloomreach results.
Redirects
Redirects of retired categories exists on remote config. Mappings are 1-1 and are not recursive.
The Application provides support for redirecting to a category when the response from the Bloomreach search api contains the following json:
"keywordRedirect": {
"redirected url": "www.toolstation.com\/automotive\/car-care-cleaning\/c961",
"redirected query": "windscreen",
"original query": "windscreen"
},
- First the app checks for the presence of a keywordRedirect element in the response json.
- Second the format of redirected url is checked to see if it matches the format for a Toolsation website category redirect URL.
- If it does then the category Id is parsed from the URL and used as the new taxonomy for the result of the search. (See the method searchForProducts in
bloomreach_service.dart) - The Application uses the same category redirects defined for the Toolstation website.
- Whenever a redirect happen we log it in analytics
- Redirects are defined in remote config, refer below:
"category_redirects": {
"67": "853",
"188": "1133",
"249": "863",
}