Lucene with PHP
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.
Use Lucene in PHP
Solr has a REST API which could be used from PHP, or any language for that matter.
Zend lucene and MySql database
I would investigate if MySQLs native Full-Text Searching would meet your needs first before jumping to a Lucene based solution. It is a major improvement upon using LIKE
statements without the additional implementation required for Lucene.
Zend_Search_Lucene is a pure PHP implementation of Lucene and can therefore be pretty slow when used with large datasets. I would skip it and look at implementing Apache Solr. There is PECL extension for it, which is documented here.
php fatal error, require once
You have to add your Zend Library to include path.
If your Zend Framework is in G:\xampp\htdocs\includes\Zend
, then you have to include it so:
<?php
$path = 'G:\xampp\htdocs\includes\Zend';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
Also you should give absolute path for Lucene data. For example:
$index = Zend_Search_Lucene::create('/var/searchindex/LuceneData/');
The folder /var/searchindex/LuceneData/
should exist and be writable.
Indexing large DB's with Lucene/PHP
I'm sorry to say it, because the developer of Zend_Search_Lucene is a friend and he has worked really hard it, but unfortunately it's not suitable to create indexes on data sets of any nontrivial size.
Use Apache Solr to create indexes. I have tested that Solr runs more than 300x faster than Zend for creating indexes.
You could use Zend_Search_Lucene to issue queries against the index you created with Apache Solr.
Of course you could also use the PHP PECL Solr extension, which I would recommend.
Related Topics
PHP Spl_Autoload_Register VS _Autoload
Compile Error: "G++: Error Trying to Exec 'Cc1Plus': Execvp: No Such File or Directory"
Boolean Variables Posted Through Ajax Being Treated as Strings in Server Side
PHP 5 Reflection API Performance
Laravel 5 Socialite - Curl Error 77: Error Setting Certificate Verify Locations
Remove Zero Values from a PHP Array
What Does [\S\S]* Mean in Regex in PHP
One Form with Two Submit Buttons and Different Actions for Each Button
Does the Condition After && Always Get Evaluated
Installing Imagemagick Extension with PHP/Windows
PHP Put a Space in Front of Capitals in a String (Regex)
How to Check in PHP That I'm in a Static Context (Or Not)
Is_Unique for Codeigniter Form Validation
Call Python from PHP and Get Return Code
Search and Replace Value in PHP Array