mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
FIX Use ArrayList and PaginatedList instead of DataObjectSet
This commit is contained in:
parent
ce03eba8b8
commit
afaf3071d4
@ -264,7 +264,7 @@ abstract class SolrIndex extends SearchIndex {
|
||||
|
||||
$res = $service->search($q ? implode(' ', $q) : '*:*', $offset, $limit, array('fq' => implode(' ', $fq)), Apache_Solr_Service::METHOD_POST);
|
||||
|
||||
$results = array();
|
||||
$results = new ArrayList();
|
||||
|
||||
foreach ($res->response->docs as $doc) {
|
||||
$result = DataObject::get_by_id($doc->ClassName, $doc->ID);
|
||||
@ -272,8 +272,14 @@ abstract class SolrIndex extends SearchIndex {
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
$ret['Matches'] = new DataObjectSet($results);
|
||||
$ret['Matches']->setPageLimits($offset, $limit, $res->numFound);
|
||||
$ret['Matches'] = new PaginatedList($results);
|
||||
$ret['Matches']->setLimitItems(false);
|
||||
// Tell PaginatedList how many results there are
|
||||
$ret['Matches']->setTotalItems($res->response->numFound);
|
||||
// Results for current page start at $offset
|
||||
$ret['Matches']->setPageStart($offset);
|
||||
// Results per page
|
||||
$ret['Matches']->setPageLength($limit);
|
||||
|
||||
return new ArrayData($ret);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user