- Модуль: search
- Путь к файлу: ~/bitrix/modules/search/classes/general/statistic.php
- Класс: CSearchStatistic
- Вызов: CSearchStatistic::PhraseStat
function PhraseStat($result_count = 0, $page_num = 0)
{
$DB = CDatabase::GetModuleConnection('search');
$DB->StartUsingMasterOnly();
$result_count = intval($result_count);
$page_num = intval($page_num);
$strSql = "
SELECT *
FROM b_search_phrase
WHERE SESSION_ID = '".$DB->ForSQL($this->_session_id)."'
AND ".($this->_phrase === false? "PHRASE IS NULL": "PHRASE = '".$DB->ForSQL($this->_phrase)."'")."
AND ".($this->_tags === false? "TAGS IS NULL": "TAGS = '".$DB->ForSQL($this->_tags)."'")."
";
$rs = $DB->Query($strSql);
if ($ar = $rs->Fetch())
{
$this->phrase_id = $ar["ID"];
if ($page_num > $ar["PAGES"])
$DB->Query("UPDATE b_search_phrase SET PAGES = ".$page_num." WHERE ID = ".$ar["ID"]);
}
else
{
$this->phrase_id = $DB->Add("b_search_phrase",
array(
"~TIMESTAMP_X" => $DB->CurrentTimeFunction(),
"SITE_ID" => SITE_ID,
"~RESULT_COUNT" => $result_count,
"~PAGES" => $page_num,
"SESSION_ID" => $this->_session_id,
"PHRASE" => $this->_phrase,
"TAGS" => $this->_tags,
"STAT_SESS_ID" => $this->_stat_sess_id,
)
);
}
$DB->StopUsingMasterOnly();
}