Search code examples
ezpublish

elasticsearch / solr search in ezpublish 2014.11


Using eZ Publish community 2014.11, I'd like to index contents in Elastic Search or Solr (or similar index engines) in order to :

  • perform full text search on contents (with respect for access rights on contents, and object relations extraction)
  • make custom calls to index in custom controllers to bypass mysql content repository limitations regarding sorting on different classes attributes

What is the prefered way of doing performing ezfind-like 2014.11 ?

Notes :

  • I'm not using legacy stack and try to avoid it as much as possible in order to facilitate further migrations, but if I have to I'll use it.
  • Currently, I'm planning to use this intallation documentation ezfind LS 5.2
  • There is some activity around these question here and here
  • there's a bundle by netgen
  • In previous versions I used to use ezfind for that which is available in 2014-11 distribution, but I also see elasticsearch bundles in this version. I quickly tried to use it but go the following errors :

```

php ezpublish/console ezpublish:elasticsearch_create_index --env=dev
PHP Fatal error:  Call to undefined method eZPublishCorePersistenceLegacyContentSearchHandler_000000007c8f5baa000000006bdeda53::setCommit() in /var/www/ez5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Cache/SearchHandler.php on line 122
PHP Stack trace:
PHP   1. {main}() /var/www/ez5/ezpublish/console:0
PHP   2. Symfony\Component\Console\Application->run() /var/www/ez5/ezpublish/console:27
PHP   3. eZ\Bundle\EzPublishCoreBundle\Console\Application->doRun() /var/www/ez5/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:124
PHP   4. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/ez5/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Console/Application.php:41
PHP   5. Symfony\Component\Console\Application->doRun() /var/www/ez5/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
PHP   6. Symfony\Component\Console\Application->doRunCommand() /var/www/ez5/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:193
PHP   7. Symfony\Component\Console\Command\Command->run() /var/www/ez5/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:896
PHP   8. eZ\Bundle\EzPublishElasticsearchBundle\Command\ElasticsearchCreateIndexCommand->execute() /var/www/ez5/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252
PHP   9. eZ\Publish\Core\Persistence\Cache\SearchHandler->setCommit() /var/www/ez5/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishElasticsearchBundle/Command/ElasticsearchCreateIndexCommand.php:61

```


Solution

  • The best way I found so far is to call ezFind from symfony as explained here :

    http://share.ez.no/blogs/carlos-revillo/ez-find-with-symfony-controller-and-twig-templates