This document describes different ways to get auto-suggestions in the storefront search box. It describes the necessary steps to configure and create the specific search indexes and gives technical background on how the suggestions are retrieved. The index types are implemented within the Solr Search Adapter Cartridge.
The available search index services that provide the different types of search indexes are managed services. You can enable the services for the organization in Intershop Organization Management.
To use the enabled search service, it is necessary to create an appropriate service configuration in the context of the organization, a channel or an application respectively. The required location of the service depends mainly on the location of the business objects you want to build the search indexes for. For example: If products are edited in the channel, the search service configuration should be located in the channel. For content that is application-specific, the search service configuration must be located in the application.
Several search index services are available for generating suggestions for the user. These services behave in different ways.
The standard product search index type already includes suggest functionality based on the data that is indexed in that index. The current index is selected by the current request locale and its online flag. The index configuration is also checked for any attributes in the configuration that have a custom AutoSuggest
value and a true
value.
... <attribute> <custom-values> <custom-value name="AutoSuggest" type="string"> <value>true</value> </custom-value> </custom-values> <name>ManufacturerName</name> <dataProviderName>ProductPO</dataProviderName> <description>The manufacturer name</description> ... </attribute>
The search index attributes that are used for suggest can be managed in Intershop Commerce Management on the Auto Suggest tab.
All data from the index attributes marked for Auto Suggest is copied to a hidden _suggest
field in the index during indexing. The suggest creates a query for the contents of the _suggest
field, prefixed by the letters that the user has typed.
When a provided suggest result is selected in the frontend, a search is triggered using the suggested term. Therefore, the index attributes used for auto-suggest are typically a subset of the index attributes used for search.
The maximum count of suggestions is set by the maxAutoSuggestResults
parameter in the ISSearchBox
ISML-module. That parameter is set in the Header.isml (app_sf_responsive_cm) template to a default value of 10
.
SFProductSearchSuggest
is an alternative implementation of auto suggest. It uses a separate index, but the data is retrieved from the SFProductSearch
product index.
The configuration for the type relies on custom value attributes configured either in the index itself or in the underlying product index.
The custom values in the suggest index at search index configuration level can configure custom values with the SuggestType_
prefix followed by a type.
The values are attribute names of the underlying product index. Available types are category
, brand
, product
, and content
. If an attribute is marked as auto suggest and the type cannot be determined, it is set to unspecified
.
<searchIndexConfiguration> ... <custom-values> <custom-value name="SuggestType_category" type="string"> <value>CategoryNameLevel0</value> <value>CategoryNameLevel1</value> </custom-value> <custom-value name="SuggestType_product" type="string"> <value>name</value> </custom-value> </custom-values> </searchIndexConfiguration>
You can also configure the type custom-values
in the suggested index custom attribute SuggestType
. The value is an available suggest type (see above).
... <attribute> <custom-values> <custom-value name="SuggestType" type="string"> <value>brand</value> </custom-value> <name>ManufacturerName</name> ... </attribute> ...
The following tables illustrate the content of the participating indexes:
Product Index Data: Each row represents a product.
Category Display Name | Brand | Product Name | Content |
---|---|---|---|
Category 1 | Brand 1 | Name 1 | Term |
Category 1 | Brand 2 | Name 2 | Term |
Category 2 | Brand 1 | Name 3 | Term |
The suggest index build processes the configured index attributes for the suggest types, reads the data from the product index and writes the results to the suggest index.
Product Suggest Index Data: Each row represents a potential suggestion.
QueryTerm | Type | HitCount | FieldName |
---|---|---|---|
Category 1 | category | 2 | Category Display Name |
Category 2 | category | 1 | Category Display Name |
Brand 1 | brand | 2 | Brand |
Brand 2 | brand | 1 | Brand |
Name 1 | product | 1 | Product Name |
Name 2 | product | 1 | Product Name |
Name 3 | product | 1 | Product Name |
Term | content | 3 | Product Name |
The suggest query uses a wildcard search on the QueryTerm
index attribute.
If an index of type SFProductSearchSuggest
is online for the current request locale, it disables the suggest from SFProductSearch
index.
The Index Type is also an index of data that is collected from other indexes. In addition to the SFProductSearchSuggest
index, it can also collect data from the SFContentSearch
index and store direct references to products, categories and content pages.
The configuration is controlled by specifying the index attributes of the underlying indexes (SFProductSearch
or SFContentSearch
) as custom values in the ISH-Config.xml of the SFObjectSuggestSearch
together with marking the attribute as auto suggest in the underlying index.
The custom values of the ObjectSuggestType_<type>
attribute determine the set of attributes that are collectible, and the index configuration auto suggest will determine the collected attributes from that configured set.
The suggest query uses a wildcard search in the QueryTerm
index attribute prefixed with the user-entered terms. It also groups the result by the Type
index attribute to get results of each type. The result size per group is set to 5 by the Solr group.limit
parameter. The suggest result generates direct links to product, category or content pages. For the suggest type brand
, it generates a search with the suggested term.
SFObjectSuggestSearch
is online for the current request locale, it disables the suggest from SFProductSearchSuggest
or SFProductSearch
indexes. The category suggestions are generated from the values that are indexed in the CategoryNameLevel<X>
index attributes. The category reference is derived from the contents of the CategoryUUIDLevelMulti
index attribute. The values of the CategoryNameLevel<X>
index attributes are the category display names of the default category assignment of the product. Thus, category suggestions are generated for the default categories to which products are assigned.
The product suggestions that are indexed in the suggest index are collected from the SFProductSearch
index. The reference is based on the value of the SKU
(the first value if it is a multiple value) or as a fallback of the sku
index attribute. The default configuration uses the name
index attribute to build suggestions based on the product display names.
Info
Solr Adapter Version 3.6.1:
Additional source attribute values that are included in the ObjectSuggestType_product
configuration are concatenated and indexed in the QueryTerm
index attribute. For example: If the SKU is included in that configuration, products are suggested when you start typing an SKU.
The content suggestions are collected from the SFContentSearch
index. The content references are generated from the index attribute PageletEntryPointID
and the query term values are taken from the title
(hard-coded) attribute. No configuration of the underlying content index is necessary.
The brand suggestions are collected from the ManufacturerName
index attribute of the SFProductSearch
index.
There is no default configuration for search suggestions. To use existing index attributes as suggestions for search, you may add an additional attribute to the suggest index and select the data provider search
. An ObjectSuggestType_<type>
custom value has to be added by editing the configuration file where the custom values list the index attributes of the product index that you want to use as search suggestions. The default storefront template SuggestResult.isml delivered with ICM does not display suggestions of type search. A search section must be added to the template to render results for the search suggestions, as shown in the following example file: app_sf_responsive:inc/search/SuggestResult.isml.
The following screenshot shows an example of the search configuration attribute of the object suggest index with the ObjectSuggestType_search
value and the associated index attribute SupplierName
:
<attribute> <custom-values> <custom-value name="ObjectSuggestType_search" type="string"> <value>SupplierName</value> </custom-value> <custom-value name="SpellCheck" type="string"> <value>false</value> </custom-value> <custom-value name="AutoSuggest" type="string"> <value>false</value> </custom-value> </custom-values> <dataProviderName>search</dataProviderName> <weight>100</weight> <sortable>false</sortable> <labelAsc></labelAsc> <labelDesc></labelDesc> <description></description> <name>searches</name> <displayName>Search Suggestions</displayName> <ID>10</ID> <dataType>0</dataType> <unit></unit> <searchable>false</searchable> <standard>false</standard> </attribute>
The suggest collector data provider only supports single-valued index attributes. (prior to Solr Cloud Adapter 3.6.1 see below)
Info
Solr Adapter Version 3.6.1: The suggest collector supports using index attributes that have multiple values and it is made possible to configure the related source attribute of the underlying data index be the custom value SourceAttributeNames
.
ICM 7.10.40.5: The configuration of multiple source index attributes can be made in the back office by selecting source attributes.
By clicking the Select button, the next page shows all the index attributes of the product index. By selecting multiple index attributes, the values of these attributes are processed in the object suggest index. Be careful when selecting attributes that have many unique values. All these values will create a separate document in the object suggest index. For the search suggestions, the selected attributes should also be marked as searchable in the product index or be part of a copy index attribute that is searchable, otherwise no products will be found when the suggestion is selected.
SFProductSearch | SFProductSearchSuggest | SFObjectSuggestSearch |
---|---|---|
Simple Configuration No additional index builds | Prefix and infix results Additional type categorization | Prefix and infix results Direct links to products, categories and content Content index suggestions included |
Restricted to provide search term suggestions Only prefix and lowercase matches | Dependent to other index builds Manual configuration necessary | A limited hard-coded set of supported attributes Dependency to other indexes Slower indexing time |