Can I use Lucene with PHP ? I don't want to use Zend. Can I use in native PHP (not framework) ?
Answers
You have to add extension=imagick.so
in your php.ini
file.
- Location:
You can do some thing like this for the fastest way:
php -i | grep 'php.ini'
The result is like that:
Loaded Configuration File => /usr/local/lib/php.ini
Or call <?php phpinfo(); ?>
from some php file to get this information :)
PS: Source
This is a quote from a Zend Certified Engineer.
Against my better judgment, the company I work for migrated our previous search solution to Zend_Search_Lucene. On pretty heavy-duty hardware, indexing a million documents took several hours, and searches were relatively slow. The indexing process consumed vast amounts of memory, and the indexes frequently became corrupted (using 1.5.2). A single wild card search literally brought the web server to its knees, so we disabled that feature. Memory usage was very high for searches, and as a result requests per second necessarily declined heavily as we had to reduce the number of Apache child processes.
We have since moved to Solr (a Lucene-based Java search server) and the difference is dramatic. Indexing now takes around 10 minutes and searches are lightning fast. What a difference a language makes.
Original Article
In this case, Java.
Ok, I found the solution:
You must add a preprocessor constant into php-src/Zend/zend_build.h:
#define PHP_COMPILER_ID "VC9"
And it will work.
Solution found here: http://forums.zend.com/viewtopic.php?f=55&t=2045
Although I have not used it, it appears that you do not need Java to use the Zend_Search_Lucene component. According to the documentation, Zend_Search_Lucene is a fully PHP implementation of Lucene.
However, there is support for interoperability between the Java indexes and the PHP indexes.
I would recommend using Apache SOLR as your Lucene backend and connecting via web service calls from your PHP code.
I'd also note that it's easy to pick and choose components of Zend Framework for use in your application without loading the entire framework. You could use Zend_Search_Lucene in your site and forego Zend's MVC, database, and related components.