The Default Browse Page
in Commerce Reference Store includes an instance of the SearchAdjustments
cartridge, called Search Adjustments
, in the main content area. This cartridge notifies the site visitor when a keyword search is automatically adjusted by the MDEX to fix spelling issues or offer alternative search suggestions. Commerce Reference Store uses the SearchAdjustments
cartridge and content item classes provided out of the box by the DAF.Endeca.Assembler
module. Commerce Reference Store includes its own application-specific SearchAdjustments
cartridge template as well as configuration for the spelling correction and Did You Mean features that are rendered by the cartridge.
Dgidx and Dgraph Flags for Search Adjustments
The Commerce Reference Store deployment template includes the Dgidx flag, <run-aspell>true</run-aspell>
, that enables the Aspell spelling mode that attempts to fix spelling errors. Also, two Dgraph flags are set. The first one, --dym_hthresh
, determines how many search results must be returned before Did You Mean suggestions are provided. Commerce Reference Store sets this flag so that, if fewer than five search results are returned, Did You Mean suggestions are also returned. The second flag, --dym_nsug
, limits the number of Did You Mean suggestions, in this case to three.
Note that these settings affect the search results returned by the MDEX regardless of whether or not the Search Adjustments
cartridge is included on a page. It is the MDEX’s responsibility to modify the search results based on its own spelling and Did You Mean configuration settings, while it is the Search Adjustments
cartridge’s responsibility to notify the shopper of any modifications the MDEX made to the search criteria in order to retrieve the current result set.
Search Adjustments Template
The XML template for the SearchAdjustments
cartridge is located in <ATG10dir>/CommerceReferenceStore/Store/Storefront/deploy/cartridge_templates/MainContent-SearchAdjustments.xml
. This template configures one property, spellSuggestionEnabled
, which is set to true
by default and cannot be edited in Experience Manager. This property overrides any MDEX-level settings and enables automatic spelling correction.
Search Adjustments and Breadcrumbs Renderers
A corresponding renderer, store.war/cartridges/SearchAdjustments/SearchAdjustments.jsp
, exists for the Search Adjustments
cartridge. The renderer code checks whether the returned content item contains any items in the adjustedSearches
array for automatic spelling correction and in the suggestedSearches
array for Did You Mean suggestions. If either of these arrays contains items, the corresponding auto-correction or Did You Mean messages are rendered on the page.
Additionally, the Breadcrumbs cartridge renderer, store.war/cartridges/Breadcrumbs/Breadcrumbs.jsp
, contains logic to display the auto-corrected search term instead of the original one. The auto-corrected search term is taken from the correctedTerms
property of Breadcrumbs
cartridge response content item.