Migrating custom search services

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

  1. Create a HCL Commerce Version 9 endpoint in your development environment.
    1. Go to the <WCDE_installdir>\workspace\search-ear directory.
    2. Import the WAR file by right-clicking search-rest-ext.war project, then click Properties > Web Project setting.
    3. Change the context root to search/ext/resource.
    4. Write your Java code and save it to the src directory under the search-logic-ext project.
    5. 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.
    6. Create your preprocessors and post processors to the src directory in the search-logic-ext project.
    7. 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.
    8. 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.
  2. Configure WCB for Search.
    1. Download the WCBSamples.zip file.
    2. 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>.
    3. 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
    4. 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
    5. Clear the contents of the <WCDE_installdir>\Build_Local_Repository\search\workspace directory.
    6. Copy search-config-ext, search-logic-ext, andsearch-rest-ext folders to the <WCDE_installdir>\Build_Local_Repository\search\workspace directory.
    7. 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
    8. 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.
  3. 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.
    1. 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.
    2. 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.
    3. 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
  4. Start the docker-compose environment.
    1. Go to the \cust directory run the following command:
      docker-compose up -d --build
    2. 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
    3. 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