Hi,
I've some problems with Zend_Search_Lucene when i activate the eAccelerator.
When I try to generate an index, I allways have this Error:
Fatal error: Exception thrown without a stack frame in Unknown on line 0
The Code:
<?php
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
$index = Zend_Search_Lucene::create(GLOBALDIR . 'tmp/search/faq-index');
$results = $db->fetchAll(
"SELECT * FROM knowledgebase"
);
foreach($results AS $result) {
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Text('title', $result['kb_subject'], 'UTF-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('dbid', $result['kb_id']));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('date', $result['kb_edate']));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('visits', $result['kb_visits']));
$doc->addField(Zend_Search_Lucene_Field::UnStored('contents', strip_tags($result['kb_body']), 'UTF-8'));
$index->addDocument($doc);
}
$index->optimize();
?>
When I try to search something, it gives me this error:
<br />
<b>Fatal error</b>: Uncaught exception 'Zend_Search_Lucene_Exception' with message 'Index compound file doesn't contain _0.del file.' in /home/login/library/zf/Zend/Search/Lucene/Index/SegmentInfo.php:258
Stack trace:
#0 /home/login/library/zf/Zend/Search/Lucene/Index/SegmentInfo.php(206): Zend_Search_Lucene_Index_SegmentInfo->openCompoundFile('.del')
#1 /home/login/library/zf/Zend/Search/Lucene.php(233): Zend_Search_Lucene_Index_SegmentInfo->__construct('_0', 10, Object(Zend_Search_Lucene_Storage_Directory_Filesystem))
#2 /home/login/library/zf/Zend/Search/Lucene.php(152): Zend_Search_Lucene->__construct('/home/login/tmp...')
#3 /home/login/application/controllers/HelpController.php(109): Zend_Search_Lucene::open('/home/login/tmp...')
#4 /home/login/library/zf/Zend/Controller/Action.php(488): HelpController->faqAction()
#5 /home/login/library/zf/Zend/Controller/Dispatcher/Standard.php(220): Zend_Controller_Action->dispatch('faqAction')
#6 /home/login/library/zf/Zend/Controller/Front.php(753): Zend_Controller_Dispatcher_Standard in <b>/home/login/library/zf/Zend/Search/Lucene/Index/SegmentInfo
The Code:
$post = Zend::registry('post');
$q = $post->getRaw('q');
if(!empty($q)) {
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
$index = Zend_Search_Lucene::open(GLOBALDIR . 'tmp/search/faq-index');
$q = mysql_escape_string(strtolower($post->getRaw('q')));
$query = Zend_Search_Lucene_Search_QueryParser::parse($q);
$hits = $index->find($query);
$view->articles = $hits;
$view->q = htmlspecialchars($post->getRaw('q'));
$view->category_overview = $this->_displayCategories();
$view->count_articles = count($hits);
$view->page = 'support/faq_search_results.tpl';
$rendered = $view->render('main/main.tpl');
$this->getResponse()->appendBody($rendered);
return;
}
When I diseable the eAcclerator cache (not the optimizer), it works.