Introduction
---------------
REST API built in WCS 7 FEP 8 onward eliminates the need to fetch the data through BOD mediation layer instead data can be directly mapped from the Solr.
Search configuration coexisting on both the WebSphere Commerce and Search EARs include the following files:
1) WebSphere Commerce search configuration file (wc-search.xml)
2) Search configuration properties in the catalog component configuration file (wc-component.xml).
3) Search configuration properties in the STORECONF table.
4) Feature Pack 8 Search configuration properties in the solrconfig.xml file
Storefront search BOD-based services and business tooling use the configurations under the WebSphere Commerce application. REST-based search services use the configurations under the WebSphere Commerce search application.
Steps to include custom data Catentry.Field4 column on PDP page REST call
-------------------------------------------------------------------------------------------------
1) Go to Path- toolkit\search\solr\home\MC_10001\en_US\CatalogEntry\conf
Modify schema.xml and wc-data-config.xml with new Solr fields
Schema.xml-
<field name="field4" type="wc_text" indexed="true" stored="true" multiValued="false"/>
wc-data-config.xml- After Adding catentry.Field4 column in the query
<field column="FIELD4" name="field4" />
2) Run preprocess with server stopped, and then start server and build Solr index
Newly included fields can be validated using the Solr testing URL-
http://localhost/solr/MC_10001_CatalogEntry_en_US/select?q=catentry_id:<catentryId>
3) Make the new search profile in wc-search.xml by extending the existing search profile invoked in the REST service call under Search folder-
<_config:profile name="X_findCatalogEntry" extends="IBM_findProductByIds_Details">
<_config:query inherits="true">
<_config:postprocessor classname="com.ibm.commerce.foundation.server.services.rest.search.postprocessor.solr.SolrRESTSearchCatalogEntryViewUserDataQueryPostprocessor" />
</_config:query>
<_config:result inherits="true">
<_config:field name="field4" />
</_config:result>
</_config:profile>
4) Make the new wc-component.xml under Search folder- (It takes care of the mapping we used to have it under wc-business-object-mediator.xml prior to version 7 feature pack 7)
<?xml version="1.0" encoding="UTF-8"?>
<_config:DevelopmentComponentConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-component.xsd "
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:valuemappingservice>
<_config:valuemapping externalName="CatalogEntryUserDataFieldNameMapping" internalName="CatalogEntryUserDataFieldNameMapping">
<_config:valuemap externalValue="FIELD4" internalValue="field4" />
</_config:valuemapping>
</_config:valuemappingservice>
</_config:DevelopmentComponentConfiguration>
5) Make the new wc-rest-resourceconfig.xml file under /Search-Rest/WebContent/WEB-INF/config/com.ibm.commerce.rest-ext/wc-rest-resourceconfig.xml
<ResourceConfig>
<Resource name="productview">
<GetUri uri="store/{storeId}/productview/byId/{productId}"
description="Get product by unique ID" searchProfile="X_findCatalogEntry,IBM_findProductByIds_Details,IBM_findProductByIdsWithAttributesAndAttachments,IBM_findProductByIds_Summary,IBM_findProductByIds_Summary_WithNoEntitlementCheck,IBM_Admin_findProductByIds"/>
</Resource>
</ResourceConfig>
6) Restart the server and access the new indexed fields in userdata section using rest call with new search profile.
7) Testing
http://localhost/search/resources/store/10158/productview/byId/121892?responseFormat=xml&catalogId=10158¤cy=USD
Please check new post for similar imlementation in WCS 8-
Customizing REST servoce over Solr in WCS 8
---------------
REST API built in WCS 7 FEP 8 onward eliminates the need to fetch the data through BOD mediation layer instead data can be directly mapped from the Solr.
Search configuration coexisting on both the WebSphere Commerce and Search EARs include the following files:
1) WebSphere Commerce search configuration file (wc-search.xml)
2) Search configuration properties in the catalog component configuration file (wc-component.xml).
3) Search configuration properties in the STORECONF table.
4) Feature Pack 8 Search configuration properties in the solrconfig.xml file
Storefront search BOD-based services and business tooling use the configurations under the WebSphere Commerce application. REST-based search services use the configurations under the WebSphere Commerce search application.
Steps to include custom data Catentry.Field4 column on PDP page REST call
-------------------------------------------------------------------------------------------------
1) Go to Path- toolkit\search\solr\home\MC_10001\en_US\CatalogEntry\conf
Modify schema.xml and wc-data-config.xml with new Solr fields
Schema.xml-
<field name="field4" type="wc_text" indexed="true" stored="true" multiValued="false"/>
wc-data-config.xml- After Adding catentry.Field4 column in the query
<field column="FIELD4" name="field4" />
2) Run preprocess with server stopped, and then start server and build Solr index
Newly included fields can be validated using the Solr testing URL-
http://localhost/solr/MC_10001_CatalogEntry_en_US/select?q=catentry_id:<catentryId>
3) Make the new search profile in wc-search.xml by extending the existing search profile invoked in the REST service call under Search folder-
<_config:profile name="X_findCatalogEntry" extends="IBM_findProductByIds_Details">
<_config:query inherits="true">
<_config:postprocessor classname="com.ibm.commerce.foundation.server.services.rest.search.postprocessor.solr.SolrRESTSearchCatalogEntryViewUserDataQueryPostprocessor" />
</_config:query>
<_config:result inherits="true">
<_config:field name="field4" />
</_config:result>
</_config:profile>
4) Make the new wc-component.xml under Search folder- (It takes care of the mapping we used to have it under wc-business-object-mediator.xml prior to version 7 feature pack 7)
<?xml version="1.0" encoding="UTF-8"?>
<_config:DevelopmentComponentConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-component.xsd "
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:valuemappingservice>
<_config:valuemapping externalName="CatalogEntryUserDataFieldNameMapping" internalName="CatalogEntryUserDataFieldNameMapping">
<_config:valuemap externalValue="FIELD4" internalValue="field4" />
</_config:valuemapping>
</_config:valuemappingservice>
</_config:DevelopmentComponentConfiguration>
5) Make the new wc-rest-resourceconfig.xml file under /Search-Rest/WebContent/WEB-INF/config/com.ibm.commerce.rest-ext/wc-rest-resourceconfig.xml
<ResourceConfig>
<Resource name="productview">
<GetUri uri="store/{storeId}/productview/byId/{productId}"
description="Get product by unique ID" searchProfile="X_findCatalogEntry,IBM_findProductByIds_Details,IBM_findProductByIdsWithAttributesAndAttachments,IBM_findProductByIds_Summary,IBM_findProductByIds_Summary_WithNoEntitlementCheck,IBM_Admin_findProductByIds"/>
</Resource>
</ResourceConfig>
6) Restart the server and access the new indexed fields in userdata section using rest call with new search profile.
7) Testing
http://localhost/search/resources/store/10158/productview/byId/121892?responseFormat=xml&catalogId=10158¤cy=USD
Please check new post for similar imlementation in WCS 8-
Customizing REST servoce over Solr in WCS 8
No comments:
Post a Comment