This blog promotes knowledge sharing through experience and collaboration. For more product information, visit our WebSphere Commerce CSE page. For easier navigation, utilize the Categories to find posts that match your interest.
Getting Started With Commerce v9 Search
Commerce v9 has introduced use of Docker to containerize the various servers included in the framework, including Commerce Search. This new design will make various operations and deployments easier than previous versions, once you get familiar with it. This blog post will go over starting up a Commerce v9 runtime environment and help you become familiar with changes to Commerce Search.
Starting up the Search server container
For simplicity, I'm setting up an Auth environment and starting up containers using Docker Compose. You can view our Knowledge Center doc on Deploying an Commerce Authoring Environment for more information on the initial setup. Once you got your Docker Compose yml file properly setup, you can run the docker-compose command and view the status of your containers as the command is running:
You can then use docker ps command to view the statuses of all of your running containers. I recommend including the --format parameter to filter down the data that's returned by docker ps command:
Here, you can see that the Search server container is using container ID d5f45fd81e74 and is considered to be in a healthy state (based on conditions set in Docker Compose yml file). Now that we know that our Search server container is ready, we can start performing some operations with it.
Navigating the Search server container
If you want to view the data within a Docker container, you can use docker exec command to run a bash shell:
From here, you can use many of your expected bash commands within the Docker container (cd, ls, vi, etc). You can also execute these commands outside of the Docker container by replacing bash with the command. For example, to find a specific file, you can use the find command in the docker exec command:
Now that we have an understanding of how to navigate the Search docker container, we should figure out all of our Commerce Search file locations we're used to from Commerce v7/v8.
Commerce Search File Locations
Search core index files
The search core index files will be under /search/index/solr/MC_<master_catalog_id>/<locale>/<index_type>/data/index/ . For example:
Search core configuration files
The out-of-the-box (OOTB) search core configuration files exist under /opt/WebSphere/Liberty/usr/servers/default/resources/search/index/managed-solr/config/v3/<index_type>/conf . For example:
The extendible search core configuration files exist under /opt/WebSphere/Liberty/usr/servers/default/resources/search/index/managed-solr/config/v3-index-ext/<index_type>/conf . For example:
Search application configuration files
The search application configuration files (wc-component.xml, wc-search.xml, etc) exist under /opt/WebSphere/Liberty/usr/servers/default/resources/search/runtime/config:
Preprocess XML files
Just like v7/v8, the preprocess XML files exist on the transaction server, which is what you would know as the "Commerce server" from v7/v8:
Now that you are familiar with the structure of Commerce v9 Search, we should look into the new indexing process to get our search index populated with data.
In v7/v8, you normally had to run setupSearchIndex to get index structure setup and updated with new changes. In v9, we've eliminated this script as we perform this operation automatically when the Search server container is started up. However, this also means that the search index will be wiped out (by default) when you shut down and start up the Search server container. As a result, you should review our white paper on Implementing a continuous deployment pipeline for WebSphere Commerce v9, which includes steps on using GlusterFS to store the index files outside of the Search server container.
Another change is the removal of the di-preprocess/di-buildindex scripts, which used be used together to preprocess and build the index. We now have a REST API on the transaction server for performing indexing. You can either use a browser extension like Postman, or use a terminal command like cURL, to call this REST API. Below is an example of using cURL to call this REST API (where the red box would be the transaction server hostname):
You can see that there is a jobStatusId returned by the request, which you can use to view the status of this indexing process by calling build status REST API on the transaction server:
Once the indexing process completes (progress = 100%), you should be able to see the new index files in the search core index data directory, as well as see your indexed data when querying the search index.
At this point, you should now have a working starter storefront to begin working with, implementing customizations and configuration changes for Commerce Search. Feel free to comment below if you have any questions or suggestions for getting started with Commerce v9 Search!