/** * Triggers the indexing of a single object. * * @param class_model $objInstance * * @return void */ public function indexObject(class_model $objInstance = null) { if (!self::isIndexAvailable()) { return; } if ($objInstance != null && $objInstance instanceof class_module_pages_pageelement) { $objInstance = $objInstance->getConcreteAdminInstance(); if ($objInstance != null) { $objInstance->loadElementData(); } } if ($objInstance == null) { return; } $objSearchDocument = new class_module_search_document(); $objSearchDocument->setDocumentId(generateSystemid()); $objSearchDocument->setStrSystemId($objInstance->getSystemid()); if ($objInstance instanceof interface_search_portalobject) { $objSearchDocument->setBitPortalObject(true); $objSearchDocument->setStrContentLanguage($objInstance->getContentLang()); } $objReflection = new class_reflection($objInstance); $arrProperties = $objReflection->getPropertiesWithAnnotation(self::STR_ANNOTATION_ADDSEARCHINDEX); foreach ($arrProperties as $strPropertyName => $strAnnotationValue) { $getter = $objReflection->getGetter($strPropertyName); $strContent = $objInstance->{$getter}(); $objSearchDocument->addContent($strPropertyName, $strContent); } //trigger event-listeners class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_search_eventidentifier::EVENT_SEARCH_OBJECTINDEXED, array($objInstance, $objSearchDocument)); $this->updateSearchDocumentToDb($objSearchDocument); }