Esempio n. 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);
     }
 }
 public function reindex()
 {
     $attribs = AttributeFormKey::getAttributes($this->getID(), 'getSearchIndexValue');
     $db = Database::connection();
     $db->Execute('delete from AttributeFormsIndexAttributes where afID = ?', array($this->getID()));
     $searchableAttributes = array('afID' => $this->getID());
     $rs = $db->Execute('select * from AttributeFormsIndexAttributes where afID = -1');
     AttributeKey::reindex('AttributeFormsIndexAttributes', $searchableAttributes, $attribs, $rs);
 }