PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Limiting the Result Set

The most computationally expensive part of searching is score calculation. It may take several seconds for large result sets (tens of thousands of hits).

Zend_Search_Lucene gives the possibility to limit result set size with getResultSetLimit() and setResultSetLimit() methods:

<?php
$currentResultSetLimit 
Zend_Search_Lucene::getResultSetLimit();

Zend_Search_Lucene::setResultSetLimit($newLimit);

The default value of 0 means 'no limit'.

It doesn't give the 'best N' results, but only the 'first N' [11].



[11] Returned hits are still ordered by score or by the specified order, if given.

Zend Framework