Search Query Processing: Autocorrect and Query Relaxation
Autocorrect and Did You Mean
A search request returns the autoCorrectQuery field when Bloomreach automatically corrects your customer's query. Autocorrect is triggered when the original query has 0 results and there's a query with similar text that does have results. You can display an indicator on the search results page when a query was autocorrected.
You can also use the did_you_mean field to ask customers if they meant a different query from the one they entered. The did_you_mean field is similar to autoCorrectQuery except it displays a list of related queries rather than automatically changing the query.
Example request and response
Here's an example keyword search request with the q parameter value set to blkca , which triggers autocorrect:
Request for blkca
GET http://http://core.dxpapi.com//api/v1/core/? account_id=<Bloomreach Provided Account ID> &auth_key=jazzhands &domain_key=example_com &request_id=8830241055782 &ref_url=http://www.example.com/home &url=http://www.example.com/index.html?q=blkca &request_type=search &rows=20 &start=0 &fl=pid,title,brand,price,sale_price,colors,sizes,thumb_image,price_range,sale_price_range &q=blkca &search_type=keyword
And here's the response, which includes the autoCorrectQuery field set to black and populates a list of similar queries in the did_you_mean field:
Response autocorrected to black
{ "response": { "numFound": 23141, "start": 0, "docs": [ ] }, "facet_counts": { }, "autoCorrectQuery": "black", "did_you_mean": [ "black", "block", "blanca" ], "category_map": { }, "sort_fields": [ ] }