public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->factoryId)) {
            return;
        }

        $searchEngineFactoryDefinition = $container->getDefinition($this->factoryId);

        foreach ($container->findTaggedServiceIds('ezpublish.searchEngine') as $id => $attributes) {
            foreach ($attributes as $attribute) {
                if (!isset($attribute['alias'])) {
                    throw new LogicException(
                        'ezpublish.searchEngine service tag needs an "alias" attribute to ' .
                        'identify the search engine. None given.'
                    );
                }

                // Register the search engine with the search engine factory
                $searchEngineFactoryDefinition->addMethodCall(
                    'registerSearchEngine',
                    array(
                        new Reference($id),
                        $attribute['alias'],
                    )
                );
            }
        }
    }