The following topic illustrates how to migrate your BOD-based search service to a
REST-based search by extending the search-rest-ext.war directory, then
configuring the build and deploy processes for Search.
Procedure
- Create a HCL Commerce Version 9 endpoint in your development
environment.
- Go to the
<WCDE_installdir>\workspace\search-ear
directory.
- Import the WAR file by right-clicking search-rest-ext.war
project, then click .
- Change the context root to search/ext/resource.
- Write your Java code and save it to the src directory under the
search-logic-ext project.
- Register that class to resources.properties in the
search-rest-ext/WebContent/WEB-INF/config directory.
Note: Remove any existing classes from the properties file.
- Create your preprocessors and post processors to the src
directory in the search-logic-ext project.
- Create a Search profile by using preprocessors and post processors in the
wc-search.xml file, which is found in the
/src/runtime/config/com.ibm.commerce.search directory.
- Associate the Search profile with the corresponding method in the
wc-rest-resourceconfig.xml file, which is found in the folder
/src/runtime/config/com.ibm.commerce.rest directory.
- Configure WCB for Search.
- Download the WCBSamples.zip file.
- Extract the ZIP file. Copy the WCBSamples/search/wcbd to your
<WCDE_installdir>/wcbd directory. Then, copy
WCBSamples/search/Build_Local_Repository to
<WCDE_installdir>.
- Open the build-local-search.properties file, and update the
following properties with the values specific to your environment.
wc.home=W:/WCDE_V9
was.home=W:/IBM/WebSphere/AppServer
web.module.list=search-rest-ext
- Open the extract-local-search.properties file, and update the
following property with the value specific to your environment.
local.extract.dir=W:/WCDE_V9/Build_Local_Repository/search
- Clear the contents of the
<WCDE_installdir>\Build_Local_Repository\search\workspace
directory.
- Copy search-config-ext, search-logic-ext,
andsearch-rest-ext folders to the
<WCDE_installdir>\Build_Local_Repository\search\workspace
directory.
- Open a command prompt, go to the
<WCDE_installdir>\wcbd directory, then execute the
following command.
wcbd-ant.bat -buildfile wcbd-build.xml -Dbuild.type=local -Dapp.type=search -Dbuild.label=demo
- Go to the
<WCDE_installdir>\wcbd\dist\server directory and verify
that your wcbd-deploy-server-local-search-demo.zip package is created. You
extract this package in the following step.
- Prepare the customized Search Docker image. This step assumes that you are using Docker
Compose in an authoring environment. For more information about creating this environment, see Deploying an HCL Commerce Version 9.0.0.0 to 9.0.1.17 authoring environment with Docker Compose.
- Create a directory that is named cust to host your
docker-compose.yml file. Then, create a cust/search
directory to host your customized package, application.xml file, and Docker file.
- Extract your wcbd-deploy-server-local-search-demo.zip to the
cust/search/CusDeploy directory, then copy the
<WCDE_installdir>\workspace\search-ear\META-INF\application.xml file to the
cust/search directory.
- In the cust/search directory, create a Docker file with the
following contents.
FROM <Docker_registry>/commerce/search-app
COPY CusDeploy /SETUP/Cus
RUN /SETUP/bin/applyCustomization.sh
- Start the docker-compose environment.
- Go to the \cust directory run the following command:
docker-compose up -d --build
- After all services are started, build your index by running the following curl
command:
curl -X POST -k -u spiuser:<password> https://localhost:5443/wcs/resources/admin/index/dataImport/build?masterCatalogId=10001
- After the index is built, browse the following URL to verify that the site is working
as expected:
https://localhost:3738/search/ext/resources/store/1/extproductview/byCategory/10001?currency='USD'&searchSource='O'&pageSize=2&pageNumber=1&langId=-1