elasticsearch / solr search in ezpublish 2014.11 - ezpublish

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
```

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

Related

function ereg deprecated, how to update to preg_match?:

I'm using an old php script that runs on php 5.2 but host no longer provides php below 5.4
I'm getting an error regarding function ereg that needs to be updated to preg_match but I have no idea how this is done and a look around the web isn't too helpful. Any help available?
Existing code:
if (!ereg('^/[^./][^/]/*$', $cfg["theme"]))
You may use
if (!preg_match('~^/[^./][^/]/*$~', $cfg["theme"]))
Pay attention to the regex delimiter, here, ~.

Laravel 5 new declaration causing an error

I am using Laravel 5.0.3 for one project few days ago. Now I create another project using the same version but I noticed the declaration (or whatever you call it) has changed from something like:
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode'
to
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class
and this is actually causing an FatalError. My idea is that this is something to do with the php version, but I don't want to update just yet.
What options do I have to sort this issue?
It's called class name resolution and a new feature that is implemented in PHP 5.5. The reason that you are getting that error is your PHP version of your PHP interpreter should be lower than PHP 5.5. Don't forget that Laravel 5.1 LTS package requires PHP 5.5.9 version minimum. You can keep your old configuration as 'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode' instead of \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class. But first, you should also downgrade your Laravel version from 5.1 to 5. Better and recommended is to upgrade your PHP version as PHP 5.4 will be soon deprecated.

In Laravel, what is meant by the term "clear compiled class"

I'm trying to use a service class in Laravel called ide-helper. It provides auto completion into PHPStorm. it is not functioning as expected. I have been advised that I should run php artisan clear-compiled.
what does the term "clear compiled" mean ?
https://github.com/barryvdh/laravel-ide-helper#automatic-phpdoc-generation-for-laravel-facades
Many thanks
Laravel uses an optimized class loader for better performance.
The command php artisan clear-compiled deletes the following 2 files:
bootstrap/compiled.php Created when you optimize classes.
app/storage/meta/services.json This file is created as Laravel tries to optimize the loading of the service providers your application uses.
For more Information on performance optimizing also see http://laravel-recipes.com/recipes/60/optimizing-the-framework-for-better-performance

Laravel Generate not working

I am running Sublime Test 2 in Windows 7 64-bit. I have installed (and re-installed many times) Laravel Generator and Laravel 4 Artisan. I have updated composer and all dependencies. But I cannot get it to work properly. If I press ctrl-shift-P and type 'laravel' I get a list of 11 Artisan options, then a list of 17 Generate options, 6 of which appear to be duplications, and then another list of 20 Artisan options. The first lot of Artisan options give WindowsError: [Error 2] The system cannot find the file specified, the Generate options give [InvalidArgumentException] There are no commands defined in the "generate" namespace.
The second batch of Artisan options do appear to work eg Laravel Artisan: Controller: Make gives a command line and if I type 'test' it creates a restful controller called test.php.
However, the more comprehensive resource generation remains unavailable to me.
Can anyone shed any light?
If you are using the way/generators package, you need to make sure to include the service provider ('Way\Generators\GeneratorsServiceProvider') in your config.app file.
First make sure you install this plugin first: https://github.com/laravelbook/laravel4-sublimetext-helper
And then you might want to do what is referred here:
http://net.tutsplus.com/tutorials/tools-and-tips/pro-workflow-in-laravel-and-sublime-text/#comment-925470112
There are other Windows users that had difficulties with this, but seem to have resolved them.

Doctrine 2.2 Bisna CLI

I can't get the Bisna doctrine cli to work. It complains about not being able to find the Symfony Console application. Notice it's trying to look for it in a nested directory of Doctrine/Symfony/Console/Symfony/Component/Console. Anybody ever seen this?
PHP Warning: require(/Users/jhicks/workspace/production/application/../library/Doctrine/Symfony/Console/Symfony/Component/Console/Application.php): failed to open stream: No such file or directory in /Users/jhicks/workspace/production/library/Doctrine/Common/ClassLoader.php on line 163
PHP Fatal error: require(): Failed opening required '/Users/jhicks/workspace/production/application/../library/Doctrine/Symfony/Console/Symfony/Component/Console/Application.php' (include_path='/Users/jhicks/workspace/production/library:.:/opt/local/lib/php') in /Users/jhicks/workspace/production/library/Doctrine/Common/ClassLoader.php on line 163
Here's the Github page for the doctrine cli from Bisna: https://github.com/guilhermeblanco/ZendFramework1-Doctrine2/blob/master/bin/doctrine.php
There are many repositories that call themsemves Bisna in Github, it is difficult to find what of them you are using without further information.
The original one is the one created by Guilherme Blanco (Bisna used to be his nickname) called Zend Framework 1 + Doctrine 2 and works like a charm, but it does not bundle the Symfony components necessary to run the CLI tool.
What you have to do is download them from GitHub (search for "Symfony" and you will find the components inside the Organization repository) and put them inside your project's library folder paying attention to the PSR #0 naming conventions.
If you provide the piece of code that generates this error and the repository and version you are using, it will be easier to detect the error and give a better answer. It is naive to try and guess the type of error, but probably you have problems with namespaces and/or how you are calling Symfony's Console component.
If you need some guidance on how this integration can be achieved, you can look at doctrine.php inside Blanco's repository.
Looks like I needed to add these two lines to my existing autoloader bootstrap method:
$symfonyAutoloader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$autoloader->pushAutoloader(array($symfonyAutoloader, 'loadClass'), 'Symfony');
I didn't think this would be necessary since I included Symfony in the autoloaderNamespaces array in my application.ini file.
autoloaderNamespaces[] = "Symfony"

Resources