I've been using the SPL LimitIterator:-
$index = Zend_Search_Lucene::open($this->_index);
$query = Zend_Search_Lucene_Search_QueryParser::parse($query);
$hits = new ArrayObject($index->find($query));
if (!count($hits)) {
return null;
}
$hits = new LimitIterator($hits->getIterator(), ($pg - 1) *
$pp, $pp);
return $hits;
(Assuming you have already defined $pp as per-page and $pg as the page
number).
Is there a way to limit the number of rows for pagination in lucene?
IF the file has millions of rows and returns say about 10k rows for
a search (all rows), the server's memory would bog down to load 10 k
rows into memory, right? How are others handling this situation?
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
4124
http://www.peptolab.com