Example #1
0
 public function reindex($index = false, $actuallyDoReindex = true)
 {
     if ($this->isAlias() && !$this->isExternalLink()) {
         return false;
     }
     if ($actuallyDoReindex || Config::get('concrete.page.search.always_reindex') == true) {
         $db = Loader::db();
         $attribs = CollectionAttributeKey::getAttributes($this->getCollectionID(), $this->getVersionID(), 'getSearchIndexValue');
         $db->Execute('delete from CollectionSearchIndexAttributes where cID = ?', array($this->getCollectionID()));
         $searchableAttributes = array('cID' => $this->getCollectionID());
         $key = new Key();
         $key->reindex('CollectionSearchIndexAttributes', $searchableAttributes, $attribs);
         if ($index == false) {
             $index = new IndexedSearch();
         }
         $index->reindexPage($this);
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 0), array('cID'), false);
         $cache = PageCache::getLibrary();
         $cache->purge($this);
         // we check to see if this page is referenced in any gatherings
         $c = Page::getByID($this->getCollectionID(), $this->getVersionID());
         $items = PageGatheringItem::getListByItem($c);
         foreach ($items as $it) {
             $it->deleteFeatureAssignments();
             $it->assignFeatureAssignments($c);
         }
     } else {
         $db = Loader::db();
         Config::save('concrete.misc.do_page_reindex_check', true);
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 1), array('cID'), false);
     }
 }
Example #2
0
 public function reindex($index = false, $actuallyDoReindex = true)
 {
     if ($this->isAlias() && !$this->isExternalLink()) {
         return false;
     }
     if ($actuallyDoReindex || Config::get('concrete.page.search.always_reindex') == true) {
         // Retrieve the attribute values for the current page
         $category = \Core::make('Concrete\\Core\\Attribute\\Category\\PageCategory');
         $indexer = $category->getSearchIndexer();
         $values = $category->getAttributeValues($this);
         foreach ($values as $value) {
             $indexer->indexEntry($category, $value, $this);
         }
         if ($index == false) {
             $index = new IndexedSearch();
         }
         $index->reindexPage($this);
         $db = \Database::connection();
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 0), array('cID'), false);
         $cache = PageCache::getLibrary();
         $cache->purge($this);
         // we check to see if this page is referenced in any gatherings
         $c = Page::getByID($this->getCollectionID(), $this->getVersionID());
         $items = PageGatheringItem::getListByItem($c);
         foreach ($items as $it) {
             $it->deleteFeatureAssignments();
             $it->assignFeatureAssignments($c);
         }
     } else {
         $db = Loader::db();
         Config::save('concrete.misc.do_page_reindex_check', true);
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 1), array('cID'), false);
     }
 }