Adding custom index fields in REST responses
You can add custom index fields to be
returned in REST responses by updating the wc-component.xml
file.
Before you begin
SolrRESTSearchCatalogEntryViewUserDataQueryPostprocessor
must be added to the
end of the query section of the search profile to activate this configuration.
In addition, ensure that the custom index field is also defined in the result section of the search profile so that the custom index field can be returned from Solr.
Procedure
-
In the wc-component.xml file, add to the
CatalogEntryUserDataFieldNameMapping
section to map a custom index column from the CatalogEntry index to the ProductView REST service response.For example, to return a custom CatalogEntry index column,indexField1
, register the following entry in the wc-component.xml file under theCatalogEntryUserDataFieldNameMapping
section:<_config:valuemapping externalName="CatalogEntryUserDataFieldNameMapping" internalName="CatalogEntryUserDataFieldNameMapping"> <_config:valuemap externalValue="responseField1" internalValue="indexField1" /> </_config:valuemapping>
-
The data from this
indexField1
is then returned under theUserData
section with the given name,responseField1
, for each CatalogEntry in ProductView REST service response.