/** * Build a Solr document for a given page * * @param integer $storeId Store ID * @param Mage_Cms_Model_Page $page Page instance * @return Apache_Solr_Document */ protected function buildPageDocument($storeId, $page) { $helper = Mage::helper('solr'); $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); $host = parse_url($baseUrl, PHP_URL_HOST); $document = new Apache_Solr_Document(); $document->setField('appKey', 'Asm_Solr'); $document->setField('type', 'cms/page'); $document->setField('id', $helper->getPageDocumentId($page->getId())); $document->setField('site', $host); $document->setField('siteHash', $helper->getSiteHashForDomain($host)); $document->setField('storeId', $storeId); $document->setField('created', $helper->dateToIso($page->getCreationTime())); $document->setField('changed', $helper->dateToIso($page->getUpdateTime())); $document->setField('sku', 'cms/page'); $document->setField('productId', 0); $document->setField('pageId', $page->getId()); $document->setField('title', $page->getTitle()); $document->setField('content', Mage::helper('solr/contentExtractor')->getIndexableContent($page->getContent())); $document->setField('keywords', $helper->trimExplode(',', $page->getMetaKeywords(), true)); $document->setField('url', Mage::helper('cms/page')->getPageUrl($page->getId())); return $document; }