Integrating search initialization enhancement

Edit on GitHub

General information

Previously, the vendor/bin/console setup:search command invoked the build and data initialization processes. Running both processes simultaneously in a read-only file system results into thebuild process failing as the codebase is already baked into images. That’s why the command has has been split into two commands for each of the processes which allows running them separately. You can find the commands below:

console search:create-indexes

Creates indexes in the search service (Elastic Search).

console search:setup:index-map

Generates IndexMap PHP files that are used by the whole application.


1) Install the required modules using Composer

Run the following command to install the required modules:

composer require spryker/search:"^8.9.0"

Make sure that the following module has been installed:

SeaRch vendor/spryker/search

2) Set up behavior

Enable the console commands provided by the Searchmodule:



namespace Pyz\Zed\Console;

use Spryker\Zed\Search\Communication\Console\SearchSetupIndicesConsole;
use Spryker\Zed\Console\ConsoleDependencyProvider as SprykerConsoleDependencyProvider;

 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider
     * @param \Spryker\Zed\Kernel\Container $container
     * @return \Symfony\Component\Console\Command\Command[]
    protected function getConsoleCommands(Container $container)
       $commands = [
          new SearchSetupIndicesConsole(),

       return $commands;