/** * Populates document with bundle data. * * @param \Solarium_Document_ReadWrite $document * @param Bundle $bundle * @param \Solarium_Query_Helper $helper */ private function updateDocumentFromBundle(\Solarium_Document_ReadWrite $document, Bundle $bundle, \Solarium_Query_Helper $helper) { $document->setField('id', $bundle->getId()); $document->setField('name', $bundle->getName()); $document->setField('ownerName', $bundle->getOwnerName()); $document->setField('ownerType', $bundle->getOwnerType()); $document->setField('fullName', $bundle->getFullName()); $document->setField('description', $bundle->getDescription()); $document->setField('readme', $bundle->getReadme()); $document->setField('totalScore', $bundle->getScore()); $document->setField('state', $bundle->getState()); $document->setField('avatarUrl', $bundle->getOwner()->getAvatarUrl()); $document->setField('lastCommitAt', $helper->formatDate(clone $bundle->getLastCommitAt())); $document->setField('lastTweetedAt', null !== $bundle->getLastTweetedAt() ? $helper->formatDate($bundle->getLastTweetedAt()) : null); $keywords = array(); foreach ($bundle->getKeywords() as $keyword) { $keywords[mb_strtolower($keyword->getValue(), 'UTF-8')] = true; } $document->setField('keywords', array_keys($keywords)); }