public static function addSelectColumns(Criteria $criteria) { parent::addSelectColumns($criteria); $criteria->addJoin(QubitRightsHolder::ID, QubitActor::ID); $criteria->addSelectColumn(QubitRightsHolder::ID); return $criteria; }
public static function addSelectColumns(Criteria $criteria) { parent::addSelectColumns($criteria); $criteria->addJoin(QubitUser::ID, QubitActor::ID); $criteria->addSelectColumn(QubitUser::ID); $criteria->addSelectColumn(QubitUser::USERNAME); $criteria->addSelectColumn(QubitUser::EMAIL); $criteria->addSelectColumn(QubitUser::SHA1_PASSWORD); $criteria->addSelectColumn(QubitUser::SALT); return $criteria; }
public static function addSelectColumns(Criteria $criteria) { parent::addSelectColumns($criteria); $criteria->addJoin(QubitRepository::ID, QubitActor::ID); $criteria->addSelectColumn(QubitRepository::ID); $criteria->addSelectColumn(QubitRepository::IDENTIFIER); $criteria->addSelectColumn(QubitRepository::DESC_STATUS_ID); $criteria->addSelectColumn(QubitRepository::DESC_DETAIL_ID); $criteria->addSelectColumn(QubitRepository::DESC_IDENTIFIER); $criteria->addSelectColumn(QubitRepository::UPLOAD_LIMIT); $criteria->addSelectColumn(QubitRepository::SOURCE_CULTURE); return $criteria; }
/** * @see xfIndex */ public function qubitPopulate($options) { $conn = Propel::getConnection(); $start = microtime(true); $this->getLogger()->log('Populating index...', $this->getName()); // if we are using an offset to resume from a segfault, optimize the index instead of deleting if (!isset($options['actorOffset']) && !isset($options['ioOffset'])) { $this->getEngine()->erase(); $this->getLogger()->log('Index erased.', $this->getName()); } else { $this->optimize(); } // set buffering and updates to be batched for better performance // NB: not sure why this doesn't work in object scope self::getInstance()->getEngine()->enableBatchMode(); $actorOffset = intval($options['actorOffset']); $ioOffset = intval($options['ioOffset']); // index actors if (-1 < $actorOffset) { // 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 ($key == 0 && 0 < $actorOffset) { $this->getLogger()->log('Ignoring first ' . $actorOffset . ' actors.'); } self::addActorIndex($actor); $this->getLogger()->log('"' . $actor->__toString() . '" inserted (' . round(microtime(true) - $start, 2) . 's) (' . ($key + $actorOffset + 1) . '/' . $rowcount . ')', $this->getName()); } } else { $this->getLogger()->log('Actors are ignored.'); } // index information objects if (-1 < $ioOffset) { // Get count of all information objects $sql = 'SELECT COUNT(*) from ' . QubitInformationObject::TABLE_NAME; $rs = $conn->query($sql); $rowcount = $rs->fetchColumn(0); // Get info objects (with offset) $criteria = new Criteria(); QubitInformationObject::addSelectColumns($criteria); if (0 < $ioOffset) { $criteria->setOffset($ioOffset); } $informationObjects = QubitInformationObject::get($criteria); // Loop through results, and add to search index foreach ($informationObjects as $key => $informationObject) { if ($key == 0 && 0 < $ioOffset) { $this->getLogger()->log('Ignoring first ' . $ioOffset . ' information objects.'); } if (0 < count($languages = $this->getTranslatedLanguages($informationObject))) { foreach ($languages as $language) { self::addInformationObjectIndex($informationObject, $language, $options); } } $this->getLogger()->log('"' . $informationObject->__toString() . '" inserted (' . round(microtime(true) - $start, 2) . 's) (' . ($key + $ioOffset + 1) . '/' . $rowcount . ')', $this->getName()); } } else { $this->getLogger()->log('Information objects are ignored.'); } $this->getLogger()->log('Index populated in "' . round(microtime(true) - $start, 2) . '" seconds.', $this->getName()); }