Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/search_helper.php
Show First 20 Lines • Show All 805 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Ensures empty search table | * Ensures empty search table | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function ensureEmptySearchTable() | public function ensureEmptySearchTable() | ||||
{ | { | ||||
$search_table = $this->getSearchTable(); | $search_table = $this->getSearchTable(); | ||||
$this->Conn->Query('DROP TABLE IF EXISTS ' . $search_table); | $sql = 'CREATE TABLE IF NOT EXISTS ' . $search_table . ' ( | ||||
$sql = 'CREATE TABLE ' . $search_table . ' ( | |||||
`Relevance` decimal(8,5) DEFAULT NULL, | `Relevance` decimal(8,5) DEFAULT NULL, | ||||
`ItemId` int(11) NOT NULL DEFAULT 0, | `ItemId` int(11) NOT NULL DEFAULT 0, | ||||
`ResourceId` int(11) DEFAULT NULL, | `ResourceId` int(11) DEFAULT NULL, | ||||
`ItemType` int(1) NOT NULL DEFAULT 0, | `ItemType` int(1) NOT NULL DEFAULT 0, | ||||
`EdPick` tinyint(4) NOT NULL DEFAULT 0, | `EdPick` tinyint(4) NOT NULL DEFAULT 0, | ||||
KEY `ResourceId` (`ResourceId`), | KEY `ResourceId` (`ResourceId`), | ||||
KEY `Relevance` (`Relevance`) | KEY `Relevance` (`Relevance`) | ||||
)'; | ) ENGINE = MEMORY'; | ||||
$this->Conn->Query($sql); | |||||
$sql = 'TRUNCATE TABLE ' . $search_table; | |||||
$this->Conn->Query($sql); | $this->Conn->Query($sql); | ||||
} | } | ||||
/** | /** | ||||
* Search table name | * Search table name | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function getSearchTable() | public function getSearchTable() | ||||
{ | { | ||||
return TABLE_PREFIX . 'ses_' . $this->Application->GetSID() . '_' . TABLE_PREFIX . 'Search'; | return TABLE_PREFIX . 'ses_' . $this->Application->GetSID() . '_' . TABLE_PREFIX . 'Search'; | ||||
} | } | ||||
} | } |