Sorry, the code should be

    $iterations = 100;
    $index = new Zend_Search_Lucene('c:\index');
    $userQuery = Zend_Search_Lucene_Search_QueryParser::parse('fifa');
    $begin = microtime(true);
    for($i = 0; $i < $iterations; ++$i) { 
      $hits = $index->find($userQuery); 
    }
    echo 'took: '.((microtime(true)-$begin)/$iterations).' seconds';

-----Ursprüngliche Nachricht-----
Von: Daniel Freudenberger [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 27. Juli 2007 19:17
An: [email protected]
Betreff: [fw-general] Zend_Search_Lucene performance issue

Hello,

I've started playing around with zend_search_lucene in the morning and at
first, I was very impressed. After that I've started to index all of the
relevant items that are stored in the database so far.

The index now contains 28069 documents and the find() method takes ~0.4
seconds to return for a very simple search expression. I've tested the same
expression against the same index with the .net lucene port and the request
took about 0.001 to 0.005 seconds. I know, I should not compare php with any
.net language (in this case c#) but we're not talking about twice the speed
or better, we're talking about the factor 100-400. 

I just hope I did something wrong or missed an important point in manual
about performance. Here's the imporant part of my code.

    $iterations = 100;
    $index = new Zend_Search_Lucene('c:\index');
    $userQuery = Zend_Search_Lucene_Search_QueryParser::parse('fifa');
    $begin = microtime(true);
    for($i = 0; $i < $iterations) { 
      $hits = $index->find($userQuery); 
    }
    echo 'took: '.(microtime(true)-$begin).' seconds';

Best regards,
Daniel


Reply via email to