This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » Search plugins » Zend Search Lucene: php timeout with small index
Zend Search Lucene: php timeout with small index [message #85486] Fri, 18 September 2009 02:56
Mindphreaker  is currently offline Mindphreaker
Messages: 151
Registered: December 2008
Location: Austria
Senior Member

I have implemented a search with zend-lucene which works fine with normal queries - mostly. But as soon as I execute a search query which has more than 100 matches (e.g. searching for * or ?), the search becomes incredibly slow. It often leads me to get the 30sec php timeout while beeing in the $index->find() method of lucene.

While executing such a search, the server's cpu-load goes to 100% on at least one cpu. So this may also be a serious problem when thinking of DOS-attacks.

My code to insert to the index:

$doc = new Zend_Search_Lucene_Document();

// store content primary key to identify it in the search results
$doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId()));
$doc->addField(Zend_Search_Lucene_Field::UnStored('ctitle', $this->getTitle(), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnStored('cdescription', $this->getDescription(), 'utf-8'));
$index = MipangaContentPeer::getLuceneIndex();

My code to execute a search query:

$index = self::getLuceneIndex();
$index->setResultSetLimit( sfConfig::get('max_results_on_lucene') );
$hits = $index->find($query);

--> when more than about 200 matches exist, this function does not return within 30sec

When there are less than 20 matches, the find-method instantly returns.

I hope you can help me Smile

See my favourite websites!

Complexity is relative. Relativity is complex. - Anonymous
Anyone who can give you orders can stop you from solving whatever problem you're being fascinated by. - Eric. S. Raymond
Previous Topic:Searching for more than 1 model with Zend Search
Next Topic:lucene problems
Goto Forum:

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software