BUGFIX: Fixed cli-script.php silently failing when reindexing, used DataList intead of DataObject->get()
MINOR: Tweaked the types expected by PaginatedList in SolarIndex
This commit is contained in:
parent
f3211d7c58
commit
9ba1906233
|
@ -149,7 +149,8 @@ class Solr_Reindex extends BuildTask {
|
|||
$originalState = SearchVariant::current_state();
|
||||
|
||||
if (isset($_GET['start'])) {
|
||||
$this->runFrom(singleton($_GET['index']), $_GET['class'], $_GET['start'], json_decode($_GET['variantstate'], true));
|
||||
$variantstate = array_values(json_decode($_GET['variantstate'],true));
|
||||
$this->runFrom(singleton($_GET['index']), $_GET['class'], $_GET['start'], $variantstate[0]);
|
||||
}
|
||||
else {
|
||||
foreach(array('framework','sapphire') as $dirname) {
|
||||
|
@ -214,7 +215,7 @@ class Solr_Reindex extends BuildTask {
|
|||
$includeSubclasses = $options['include_children'];
|
||||
$filter = $includeSubclasses ? "" : '"ClassName" = \''.$class."'";
|
||||
|
||||
$items = DataObject::get($class, $filter, "", "", array('limit' => $this->stat('recordsPerRequest'), 'start' => $start));
|
||||
$items = DataList::create($class)->where($filter)->limit($this->stat('recordsPerRequest'), $start);
|
||||
foreach ($items as $item) { $index->add($item); $item->destroy(); }
|
||||
}
|
||||
|
||||
|
|
|
@ -264,14 +264,14 @@ 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);
|
||||
if ($result) $results[] = $result;
|
||||
}
|
||||
|
||||
$ret = new ArrayList();
|
||||
$ret = array();
|
||||
$ret['Matches'] = new PaginatedList($results);
|
||||
$ret['Matches']->setTotalItems($res->numFound); // Tell PaginatedList how many results there are
|
||||
$ret['Matches']->setPageStart($offset); // Results for current page start at $offset
|
||||
|
|
Loading…
Reference in New Issue