Issues

ZF-92: Zend_Search_Lucene find() result set size restriction (reported by tobias382 gm l.c m in ald issue tracker)

Description

Below is a diff between a modified version of Zend/Search/Lucene.php and the original from 0.1.3. The differences add a feature to Zend_Search_Lucene::find() to allow an offset from the start of the result set and a maximum returned result set size to be specified without breaking backward compatibility. I've found that it substantially reduces processing time in cases where only a portion of the result set is desired.

218c218

< public function find($query, $offset = 0, $rowCount = 0)

public function find($query) 232d231 < $hitsCount = 0; 238, 241d236 < $hitsCount++; < if( $hitsCount <= $offset ) { < continue; < } 248, 250d242 < if ($rowCount == $hitsCount) { < break; < } 577c569

< }

}

Comments

find() needs to retrive full result set to order it by score.

From the other side each $hits entry is only <docID, score> pair. All other document attributes are retrieved from index "by request". Thus it's not necessary to limit result set.

With best regards, Alexander Veremyev.

This improvement will not increase performance actually, but only will complicate API.