In another typing error scenario, if the shopper searches for “srop,” the app displays a “Did you mean” message:
Did you mean?
When we look at the response JSON, we see three suggested searches for “srop”:
"MainContent": [ { "enabled": true, "originalTerms": [ "truck" ], "@type": "SearchAdjustments", "name": "Search Adjustments", "suggestedSearches": { "truck": [ { "contentPath": "/browse", "count": null, "@class": "com.endeca.infront.cartridge.model.SuggestedSearch", "label": "brick", "navigationState": "?Dy=1&Nf=product.startDate%7CLTEQ+1.3794624E12%7C%7Cproduct.endDate%7CGTEQ+1.3794624E12&Nr=AND%28product.priceListPair%3AsalePrices_listPrices%2Cproduct.language%3AEnglish%2COR%28product.siteId%3AstoreSiteUS%29%29&Ntp=0&Ntt=brick&Nty=1&_D%3AsiteScope=+&format=JSON&siteScope=ok", "autoPhrased": false, "siteRootPath": "/pages", "spellCorrected": true }, { "contentPath": "/browse", "count": null, "@class": "com.endeca.infront.cartridge.model.SuggestedSearch", "label": "try", "navigationState": "?Dy=1&Nf=product.startDate%7CLTEQ+1.3794624E12%7C%7Cproduct.endDate%7CGTEQ+1.3794624E12&Nr=AND%28product.priceListPair%3AsalePrices_listPrices%2Cproduct.language%3AEnglish%2COR%28product.siteId%3AstoreSiteUS%29%29&Ntp=0&Ntt=try&Nty=1&_D%3AsiteScope=+&format=JSON&siteScope=ok", "autoPhrased": false, "siteRootPath": "/pages", "spellCorrected": true } ] } },
If you examine the JSP you can see that the code executes when there are “Did you mean?” and suggested items or search adjustments:
<dsp:page> <dsp:importbean bean="/OriginatingRequest" var="originatingRequest"/> <dsp:getvalueof var="contentItem" vartype="com.endeca.infront.assembler.ContentItem" value="${originatingRequest.contentItem}"/> <c:if test="${not empty contentItem.adjustedSearches || not empty contentItem.suggestedSearches}"> <div class="SearchAdjustments"> <%-- Search adjustments --%> <c:forEach var="originalTerm" items="${contentItem.originalTerms}" varStatus="status"> <c:if test="${not empty contentItem.adjustedSearches[originalTerm]}"> <fmt:message key="mobile.search.adjust.description"><fmt:param><span>${originalTerm}</span></fmt:param></fmt:message> <c:forEach var="adjustment" items="${contentItem.adjustedSearches[originalTerm]}" varStatus="status"> <span class="autoCorrect">${adjustment.adjustedTerms}</span> <c:if test="${!status.last}">, </c:if> </c:forEach> </c:if> <%-- "Did You Mean?" --%> <c:if test="${not empty contentItem.suggestedSearches[originalTerm]}"> <div class="DYM"> <fmt:message key="mobile.search.adjust.didYouMean"> <fmt:param> <c:forEach var="suggestion" items="${contentItem.suggestedSearches[originalTerm]}" varStatus="status"> <a href="${siteBaseURL}${suggestion.contentPath}${suggestion.navigationState}">${suggestion.label}</a> <c:if test="${!status.last}">, </c:if> </c:forEach> </fmt:param> </fmt:message> </div> </c:if> </c:forEach> </div> </c:if> </dsp:page>
We can see what the JSP is looking for:
contentItem.suggestedSearches[originalTerm]
which corresponds to:
suggestedSearches[srop]
and returns the three items for strap, step and trip which we saw in the JSON response.
The “Did you mean?” function is part of the search adjustments cartridge and is enabled by default once you begin using the search adjustments cartridge.
Dimensions included in auto suggest
Not every dimension is included in auto suggestion. The table below shows which are and which are not. For example, a shopper entering a color would not see suggestions displayed.
Dimension | Included in Auto Suggest |
---|---|
color | No |
size | No |
wood finish | No |
Type | No |
Brand | Yes |
catalog id | No |
Category | No |
Disallowasrecommendation | No |
Sku.siteid | No |
product.feature.Displayname | Yes |
Language | No |
Nonreturnable | No |
Pricelistpair | No |
Product.siteid | No |