We have a requirement to retrieve 3 kinds of search suggestions:
Its important to note here that the brand suggestions should come from a custom attribute named Brand
.
So far we have tried 2 different approaches, both unsuccessful for different reasons:
By using the SF Object Suggest Search
we almost got what we needed. The product and category suggestions are working as expected. The problem lies with the brand suggestions. According to the documentation the brand suggestions come from the ManufacturerName
attribute:
The brand suggestions are collected from the ManufacturerName index attribute of the SFProductSearch index.
Besides it being a very bad practice from Intershop to name something Brand
whilst it is actually the ManufacturerName
our real problem with this is that
all our products have a custom attribute named Brand
which specifies the brand, and we use the default ManufacturerName
field for the actual manufacturer of the product.
What we would like to achieve is that the brand suggestions are collected from the Brand
index attribute of the SFProductSearch
index instead of from the ManufacturerName
index attribute.
The documentation also specifies that one of the downsides of the SFObjectSuggestSearch
is that it has:
A limited hard-coded set of supported attributes
This made us believe that it will never be possible to modify the SFObjectSuggestSearch
in such a way that it behaves in the way we want. So we tried approach 2.
By using the SFProduct Search Suggest
and adding the autosuggest attributes to the SFProductSearch
product index we are able to retrieve all the attributes we need.
The downside of this approach is however that all SolrSuggestResultItem
objects that are created have the type of Unspecified
, which makes it impossible for us to group the products, categories and brands together in a nice way.
The documentation on this point is extremely poor/vague as it reads:
The custom values in the suggest index at search index configuration level can configure custom values with the prefix SuggestType_ followed by a type.
So we suspect we have to do something with SuggestType_
but we can't seem to figure it out. The search index configuration options in the backoffice don't seem to provide anything like it. As a last resort we also tried to make the changes directly into the ISH-Config.xml
but any changes in these files are overridden every time the search index is build.
SolrSuggestResultItems
all have a type of Unspecified
.Is there any way to get this working with either of these approaches? At this point we don't have a preference for approach 1 or 2, so a solution for either one, or guidance towards a more suitable approach, would be greatly appreciated.
To answer my own question:
After some experimentation we got it to work by making a modification to approach 1.
Inside the ISH-Config.xml
we changed this:
<custom-value name="ObjectSuggestType_brand" type="string">
<value>ManufacturerName</value>
</custom-value>
To this:
<custom-value name="ObjectSuggestType_brand" type="string">
<value>Brand</value>
</custom-value>
With this configuration the brand suggestions are now collected from the Brand
index attribute of the SFProductSearch
index instead of from the ManufacturerName
index attribute.
By redeploying the server directly after making this change the configuration won't be overridden when you make changes to the SF Object Suggest Search
later on.