Author: david
Date: Tue Jul 12 14:29:26 2011
New Revision: 9306
Log:
Use Criteria::setOffset() to skip actors, like r9257 and r9304
Modified:
trunk/lib/search/QubitSearch.class.php
Modified: trunk/lib/search/QubitSearch.class.php
==============================================================================
--- trunk/lib/search/QubitSearch.class.php Tue Jul 12 14:20:22 2011
(r9305)
+++ trunk/lib/search/QubitSearch.class.php Tue Jul 12 14:29:26 2011
(r9306)
@@ -95,22 +95,33 @@
// index actors
if (-1 < $actorOffset)
{
- $actors = QubitActor::getAll();
- $counter = count($actors);
+ // Get count of all actors
+ $sql = 'SELECT COUNT(*) from '.QubitActor::TABLE_NAME;
+ $rs = $conn->query($sql);
+ $rowcount = $rs->fetchColumn(0);
+
+ // Get actors (with offset)
+ $criteria = new Criteria;
+ QubitActor::addSelectColumns($criteria);
+
+ if (0 < $actorOffset)
+ {
+ $criteria->setOffset($actorOffset);
+ }
+
+ $actors = QubitActor::get($criteria);
+
+ // Loop through results, and add to search index
foreach ($actors as $key => $actor)
{
- if (isset($actorOffset) && $key < $actorOffset)
+ if ($key == 0 && 0 < $actorOffset)
{
- if ($key == 0)
- {
- $this->getLogger()->log('Ignoring first '.$actorOffset.' actors.');
- }
-
- continue;
+ $this->getLogger()->log('Ignoring first '.$actorOffset.' actors.');
}
self::addActorIndex($actor);
- $this->getLogger()->log('"'.$actor->__toString().'" inserted
('.round(microtime(true) - $start, 2).'s) ('.($key + 1).'/'.$counter.')',
$this->getName());
+
+ $this->getLogger()->log('"'.$actor->__toString().'" inserted
('.round(microtime(true) - $start, 2).'s) ('.($key + $actorOffset +
1).'/'.$rowcount.')', $this->getName());
}
}
else
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.