Exemplo n.º 1
0
		public function reindex($index = false) {
			if ($this->isAlias()) {
				return false;
			}
			$db = Loader::db();
			
			Loader::model('attribute/categories/collection');
			$attribs = CollectionAttributeKey::getAttributes($this->getCollectionID(), $this->getVersionID(), 'getSearchIndexValue');
	
			$db->Execute('delete from CollectionSearchIndexAttributes where cID = ?', array($this->getCollectionID()));
			$searchableAttributes = array('cID' => $this->getCollectionID());
			$rs = $db->Execute('select * from CollectionSearchIndexAttributes where cID = -1');
			AttributeKey::reindex('CollectionSearchIndexAttributes', $searchableAttributes, $attribs, $rs);
			
			if ($index == false) {
				Loader::library('database_indexed_search');
				$index = new IndexedSearch();
			}
			
			$datetime = Loader::helper('date')->getSystemDateTime();
			
			$db->Replace('PageSearchIndex', array(
				'cID' => $this->getCollectionID(), 
				'cName' => $this->getCollectionName(), 
				'cDescription' => $this->getCollectionDescription(), 
				'cPath' => $this->getCollectionPath(),
				'cDatePublic' => $this->getCollectionDatePublic(), 
				'content' => $index->getBodyContentFromPage($this),
				'cDateLastIndexed' => $datetime
			), array('cID'), true);			
		}