/** * Index a object. * * First delete all the entries for this object for delete the unused strings. * Then get all the fields and values to index. * Then index each of one. * * @param Phprojekt_Item_Abstract $object The item object. * * @return void */ public function indexObjectItem($object) { $words = array(); $moduleId = Phprojekt_Module::getId($object->getModelName()); $itemId = $object->id; $wordsId = $this->_wordModule->deleteWords($moduleId, $itemId); $this->_words->decreaseWords($wordsId); $data = $this->_getObjectDataToIndex($object); $this->_display->saveDisplay($object, $moduleId, $itemId); foreach ($data as $key => $value) { $type = $object->getInformation()->getType($key); if (null !== $type) { if ($type == 'upload') { $field = array('type' => $type, 'key' => $key); $files = Phprojekt_Converter_Text::convert($object, $field); $value = $this->_files->getWordsFromFile($files); } if ($type != 'hidden') { $words[] = $value; } } } $wordsId = $this->_words->indexWords(implode(" ", $words)); $this->_wordModule->indexWords($moduleId, $itemId, $wordsId); }