Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SU-946 , SU-945 ; Spell correction with autocorrect and did-you-mean (#…
…377) * SU-1094: Add auto-correct and did-you-mean for search-results * SU-1100: Add Did-You-Mean for Search Results (#371)
- Loading branch information
1 parent
8904b83
commit 307ee76
Showing
6 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="mz-did-you-mean"> | ||
{% with model.spellcheck.candidateCorrections|first as firstCandidate %} | ||
{% if firstCandidate.query %} | ||
<h2> | ||
<span>{{ labels.searchResultsDidyoumean }}:</span> | ||
<a href="{% make_url "search" with query=firstCandidate.query and spellcorrectOverride='skipall' as_parameters %}"> | ||
{{ firstCandidate.query }} | ||
</a> | ||
</h2> | ||
{% endif %} | ||
{% endwith %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
<h1 class="mz-pagetitle">{{ labels.searchResults }}: <span class="mz-searchresults-query">{{ pageContext.search.query }}</span></h1> | ||
{% partial_cache model.categoryId pageContext.Sorting pageContext.Pagination pageContext.query.sortBy pageContext.search.query %} | ||
{% include "modules/product/faceted-products" %} | ||
{% endpartial_cache %} | ||
{% dropzone "search-results" scope="template" %} | ||
{% if model.spellcheck.autoCorrected %} | ||
<h1 class="mz-pagetitle">{{ labels.searchResultsAutocorrected }}: <span class="mz-searchresults-query">{{ model.spellcheck.correctedQuery }}</span></h1> | ||
{% else %} | ||
<h1 class="mz-pagetitle">{{ labels.searchResults }}: <span class="mz-searchresults-query">{{ pageContext.search.query }}</span></h1> | ||
{% endif %} | ||
|
||
{% include "modules/search/did-you-mean" %} | ||
|
||
{% if model.spellcheck.autoCorrected %} | ||
{% partial_cache model.categoryId pageContext.Sorting pageContext.Pagination pageContext.query.sortBy model.spellcheck.correctedQuery %} | ||
{% include "modules/product/faceted-products" %} | ||
{% endpartial_cache %} | ||
{% else %} | ||
{% partial_cache model.categoryId pageContext.Sorting pageContext.Pagination pageContext.query.sortBy pageContext.search.query %} | ||
{% include "modules/product/faceted-products" %} | ||
{% endpartial_cache %} | ||
{% endif %} | ||
|
||
{% dropzone "search-results" scope="template" %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
{% extends "page" %} | ||
|
||
{% block title-tag-content %}{{ labels.searchTitle|string_format(pageContext.search.query) }} - {% parent %}{% endblock title-tag-content %} | ||
{% block title-tag-content %} | ||
{% if model.spellcheck.autoCorrected %} | ||
{{ labels.searchTitle|string_format(model.spellcheck.correctedQuery) }} - {% parent %} | ||
{% else %} | ||
{{ labels.searchTitle|string_format(pageContext.search.query) }} - {% parent %} | ||
{% endif %} | ||
{% endblock title-tag-content %} | ||
|
||
{% block body-tag-classes %} mz-searchresults {% endblock body-tag-classes %} | ||
|
||
{% block body-content %} | ||
|
||
{% require_script "pages/search" %} | ||
|
||
<div {% if pageContext.categoryId %}data-mz-category="{{ pageContext.categoryId }}" {% endif %}data-mz-search="{{ pageContext.search.query }}" class="mz-l-container"> | ||
{% include "pages/search-interior" %} | ||
</div> | ||
|
||
{% require_script "pages/search" %} | ||
<div {% if pageContext.categoryId %}data-mz-category="{{ pageContext.categoryId }}" {% endif %} | ||
data-mz-search="{% firstof model.spellcheck.CorrectedQuery pageContext.search.query %}" class="mz-l-container"> | ||
{% include "pages/search-interior" %} | ||
</div> | ||
{% endblock body-content %} | ||
|