Viewed   64 times

Can I use Lucene with PHP ? I don't want to use Zend. Can I use in native PHP (not framework) ?



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.

Tuesday, August 9, 2022

You have to add 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

Monday, August 29, 2022

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.

Monday, October 17, 2022

Ok, I found the solution:

You must add a preprocessor constant into php-src/Zend/zend_build.h:


And it will work.

Solution found here:

Saturday, December 10, 2022

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.

Monday, September 12, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :