SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Nov 2005
    Posts
    1,191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Zend/Lucene issue

    I'm having probs with Lucene (just grabbed the latest ZF), I've traced it a little, and it seems to be a file locking problem. $index->addDocument($doc); in the script below (more or less copy pasted from the docs) throws an exception from a destructor (ie useless). I removed an @ and vardumped the file names in the code that was causing it (constructor in Zend_Search_Lucene_Storage_File_Filesystem) to get the o/p below.

    Anyone experienced this? Got any ideas on how to solve (even tmp patches?)?

    PHP Code:
    require 'Zend/Search/Lucene.php';
    $index Zend_Search_Lucene::create('my-index');
    $doc = new Zend_Search_Lucene_Document();
    // Store document URL to identify it in the search results
    $doc->addField(Zend_Search_Lucene_Field::Text('url''xxx'));
    // Index document contents
    $doc->addField(Zend_Search_Lucene_Field::UnStored('contents''some blah bla bl b'));
    // Add document to the index
    $index->addDocument($doc); 
    Code:
    string(27) "my-index/read.lock.file
    " string(25) "my-index/segments.gen
    " string(28) "my-index/write.lock.file
    " string(23) "my-index/segments_4
    " string(25) "my-index/segments.gen
    " string(23) "my-index/segments_5
    " string(28) "my-index/write.lock.file
    " string(25) "my-index/segments.gen
    " string(23) "my-index/segments_5
    " string(19) "my-index/_4.fdx
    " string(19) "my-index/_4.fdt
    " string(35) "my-index/optimization.lock.file
    " string(19) "my-index/_4.fnm
    "
    Warning: fopen(my-index/_4.fnm) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\www\test\Zend\library\Zend\Search\Lucene\Storage\File\Filesystem.php on line 62
    
    Fatal error: Exception thrown without a stack frame in Unknown on line 0
    The above is from Win7/WAMP, but it's the same on Ubuntu, php 5.3 in both cases.

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it because of the path given relative?
    Zend_Search_Lucene::create() requires an absolute path
    Pass a relative path to Zend_Search_Lucene::create(), which is the location of the Lucene index. During shutdown the destructor of a class in Zend Lucene will try to write out the index if it was modified. Since PHP resets the current working directory to / on some SAPIs (e.g. apache) writing the index will fail because the relative path now points to a different location. Thus Zend Lucene throws an Exception without a stack frame because it took place during shutdown.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2005
    Posts
    1,191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd say that is indeed it, thanks rajug.

  4. #4
    Non-Member 68share's Avatar
    Join Date
    Nov 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I setup zend and test example search lucene. But have error follow:
    Fatal error: Exception thrown without a stack frame in Unknown on line 0
    Can you help me?
    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •