Ticket #248 (assigned defect)

Opened 1 year ago

Last modified 3 months ago

Zend_Search_Lucene

Reported by: bleistift Assigned to: hans (accepted)
Priority: major Milestone:
Component: eAccelerator Version: 0.9.5
Keywords: Cc:

Description

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-&gt;openCompoundFile('.del')
#1 /home/login/library/zf/Zend/Search/Lucene.php(233): Zend_Search_Lucene_Index_SegmentInfo-&gt;__construct('_0', 10, Object(Zend_Search_Lucene_Storage_Directory_Filesystem))
#2 /home/login/library/zf/Zend/Search/Lucene.php(152): Zend_Search_Lucene-&gt;__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-&gt;faqAction()
#5 /home/login/library/zf/Zend/Controller/Dispatcher/Standard.php(220): Zend_Controller_Action-&gt;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.

Change History

08/14/07 17:16:14 changed by hans

  • owner changed from somebody to hans.
  • status changed from new to assigned.

10/31/07 17:39:16 changed by j0k3r

Hi I got the same error :

Index compound file doesn't contain _0.del file. in /etc/httpd/lib/php/lib_zdf/Zend/Search/Lucene/Index/SegmentInfo.php on line 258

I run under Wamp 1.7.3 with eAc 0.9.5 (eAccelerator0952_5.2.4.dll) If i disabled eAc, all works fine ! And i can test your patch hans, the link is broken and i'm on windows :-/

12/27/07 18:29:04 changed by cawaspb

That looks like eAccelerator doesn't catch an exception when it's actually has a class inherited from specified.

I just fixed this in Zend_Search_Lucene (will be available with next mini-release). But it may still be a problem for other applications.

04/09/08 14:30:28 changed by bladder

waited a long time for this thingy. Schüchternheit Charisma