/** * @see xfIndex */ public function populate() { $this->setup(); $start = microtime(true); $this->getLogger()->log('Populating index...', $this->getName()); $this->engine->erase(); $this->getLogger()->log('Index erased.', $this->getName()); $this->engine->open(); $services = $this->getServiceRegistry()->getServices(); $this->getLogger()->log('Found "' . count($services) . '" services.', $this->getName()); foreach ($services as $service) { $name = $service->getIdentifier()->getName(); $this->getLogger()->log('Processing service "' . $name . '"...', $this->getName()); for ($x = 0; count($objects = $service->getIdentifier()->discover($x)) > 0; $x++) { foreach ($objects as $object) { $doc = $service->buildDocument($object); $this->engine->add($doc); $this->getLogger()->log('Document "' . $doc->getGuid() . '" inserted.', $this->getName()); } } } $this->getLogger()->log('Index populated in "' . round(microtime(true) - $start, 2) . '" seconds.', $this->getName()); }
/** * @see xfEngine */ public function erase() { $this->engine->erase(); }