As the optimization process of Zend_Search_Lucene index file using the optimize() method takes few seconds to complete, I want to create a Cron Job so that the optimization process of Index file will be done automatic everyday.
But I am not able to use the Zend_Search_Lucene component separately outside the Zend Framework.
I am using Zend Framework 1.
I have already created the Zend_Search_Lucene index file.
I have written the following piece of code separately inside trunk>public>test.php
to optimize my existing Zend_Search_Lucene Index file:
<?php
require_once ('../library/Zend/Search/Lucene.php');
// Open existing index
$index = Zend_Search_Lucene::open('../application/searchindex');
// Optimize index.
$index->optimize();
echo "Index Optimized";
echo "Total documents: ".$index->numDocs();
And I am getting following error:
Warning: require_once(Zend/Search/Lucene/Document/Html.php): failed to open stream: No such file or directory in C:\apache\htdocs\dezyre_oct\trunk\library\Zend\Search\Lucene.php on line 27
Fatal error: require_once(): Failed opening required 'Zend/Search/Lucene/Document/Html.php' (include_path='.;C:\php\pear') in C:\apache\htdocs\dezyre_oct\trunk\library\Zend\Search\Lucene.php on line 27
Could anybody help to use Zend_Search_Lucene component separately outside Zend Framework?
You should set include path of your zend library something like below
$path = '/var/www/lib/Zend';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
after that include Zend Loader to use zend autoloader
require_once('Zend/Loader.php');