本文整理汇总了PHP中CSearch::KillEntities方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::KillEntities方法的具体用法?PHP CSearch::KillEntities怎么用?PHP CSearch::KillEntities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSearch
的用法示例。
在下文中一共展示了CSearch::KillEntities方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Index
//.........这里部分代码省略.........
//$DB->Commit();
return $ID;
}
unset($arFields["MODULE_ID"]);
unset($arFields["ITEM_ID"]);
if($bBody || $bTitle || $bTags)
{
if(array_key_exists("INDEX_TITLE", $arFields) && $arFields["INDEX_TITLE"] === false)
{
$content = "";
}
else
{
if($bTitle)
$content = $arFields["TITLE"]."\r\n";
else
$content = $arResult["TITLE"]."\r\n";
}
if($bBody)
$content .= $arFields["BODY"]."\r\n";
else
$content .= $arResult["BODY"]."\r\n";
if($bTags)
$content .= $arFields["TAGS"];
else
$content .= $arResult["TAGS"];
$content = preg_replace("'&#(\d+);'e", "chr(\\1)", $content);
$arFields["SEARCHABLE_CONTENT"] = CSearch::KillEntities(ToUpper($content));
}
if(strlen($SEARCH_SESS_ID)>0)
$arFields["UPD"] = $SEARCH_SESS_ID;
if(array_key_exists("TITLE", $arFields))
{
$DB->Query("DELETE FROM b_search_content_title WHERE SEARCH_CONTENT_ID = ".$ID, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if(
!array_key_exists("INDEX_TITLE", $arFields)
|| $arFields["INDEX_TITLE"] !== false
)
CSearch::IndexTitle($arFields["SITE_ID"], $ID, $arFields["TITLE"]);
}
if(is_set($arFields, "SEARCHABLE_CONTENT"))
{
if(BX_SEARCH_VERSION > 1)
{
$text_md5 = md5($arFields["SEARCHABLE_CONTENT"]);
$rsText = $DB->Query("SELECT SEARCH_CONTENT_MD5 FROM b_search_content_text WHERE SEARCH_CONTENT_ID = ".$ID);
$arText = $rsText->Fetch();
if(!$arText || $arText["SEARCH_CONTENT_MD5"] !== $text_md5)
{
CSearch::CleanFreqCache($ID);
$DB->Query("DELETE FROM b_search_content_stem WHERE SEARCH_CONTENT_ID = ".$ID, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if (COption::GetOptionString("search", "agent_stemming") === "Y")
CSearch::DelayStemIndex($ID);
else
CSearch::StemIndex($arFields["SITE_ID"], $ID, $arFields["SEARCHABLE_CONTENT"]);
$DB->Query("DELETE FROM b_search_content_text WHERE SEARCH_CONTENT_ID = ".$ID, false, "File: ".__FILE__."<br>Line: ".__LINE__);
$arText = array(
示例2: Index
//.........这里部分代码省略.........
//$DB->Commit();
return $ID;
}
unset($arFields["MODULE_ID"]);
unset($arFields["ITEM_ID"]);
if($bBody || $bTitle || $bTags)
{
if(array_key_exists("INDEX_TITLE", $arFields) && $arFields["INDEX_TITLE"] === false)
{
$content = "";
}
else
{
if($bTitle)
$content = $arFields["TITLE"]."\r\n";
else
$content = $arResult["TITLE"]."\r\n";
}
if($bBody)
$content .= $arFields["BODY"]."\r\n";
else
$content .= $arResult["BODY"]."\r\n";
if($bTags)
$content .= $arFields["TAGS"];
else
$content .= $arResult["TAGS"];
$content = preg_replace_callback("/&#(\\d+);/", array("CSearch", "chr"), $content);
$arFields["SEARCHABLE_CONTENT"] = CSearch::KillEntities(ToUpper($content));
}
if(strlen($SEARCH_SESS_ID)>0)
$arFields["UPD"] = $SEARCH_SESS_ID;
if(array_key_exists("TITLE", $arFields))
{
$DB->Query("DELETE FROM b_search_content_title WHERE SEARCH_CONTENT_ID = ".$ID, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if(
!array_key_exists("INDEX_TITLE", $arFields)
|| $arFields["INDEX_TITLE"] !== false
)
CSearch::IndexTitle($arFields["SITE_ID"], $ID, $arFields["TITLE"]);
}
if($bTags && ($arResult["TAGS"] != $arFields["TAGS"]))
{
CSearchTags::CleanCache("", $ID);
$DB->Query("DELETE FROM b_search_tags WHERE SEARCH_CONTENT_ID = ".$ID, false, "File: ".__FILE__."<br>Line: ".__LINE__);
CSearch::TagsIndex($arFields["SITE_ID"], $ID, $arFields["TAGS"]);
}
foreach(GetModuleEvents("search", "OnBeforeIndexUpdate", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
CSearch::Update($ID, $arFields);
$arFields["MODULE_ID"] = $arResult['MODULE_ID'];
$arFields["ITEM_ID"] = $arResult['ITEM_ID'];
CSearchFullText::getInstance()->replace($ID, $arFields);
}
else
{
示例3: replace
public function replace($ID, $arFields)
{
$DB = CDatabase::GetModuleConnection('search');
if (array_key_exists("~DATE_CHANGE", $arFields)) {
$arFields["DATE_CHANGE"] = $arFields["~DATE_CHANGE"];
unset($arFields["~DATE_CHANGE"]);
} elseif (array_key_exists("LAST_MODIFIED", $arFields)) {
$arFields["DATE_CHANGE"] = $arFields["LAST_MODIFIED"];
unset($arFields["LAST_MODIFIED"]);
} elseif (array_key_exists("DATE_CHANGE", $arFields)) {
$arFields["DATE_CHANGE"] = $DB->FormatDate($arFields["DATE_CHANGE"], "DD.MM.YYYY HH:MI:SS", CLang::GetDateFormat());
}
$DATE_FROM = intval(MakeTimeStamp($arFields["DATE_FROM"]));
if ($DATE_FROM > 0) {
$DATE_FROM -= CTimeZone::GetOffset();
}
$DATE_TO = intval(MakeTimeStamp($arFields["DATE_TO"]));
if ($DATE_TO > 0) {
$DATE_TO -= CTimeZone::GetOffset();
}
$DATE_CHANGE = intval(MakeTimeStamp($arFields["DATE_CHANGE"]));
if ($DATE_CHANGE > 0) {
$DATE_CHANGE -= CTimeZone::GetOffset();
}
$BODY = CSearch::KillEntities($arFields["BODY"]) . "\r\n" . $arFields["TAGS"];
$sql = "\n\t\t\tREPLACE INTO " . $this->indexName . " (\n\t\t\t\tid\n\t\t\t\t,title\n\t\t\t\t,body\n\t\t\t\t,module_id\n\t\t\t\t,module\n\t\t\t\t,item_id\n\t\t\t\t,item\n\t\t\t\t,param1_id\n\t\t\t\t,param1\n\t\t\t\t,param2_id\n\t\t\t\t,param2\n\t\t\t\t,date_change\n\t\t\t\t,date_from\n\t\t\t\t,date_to\n\t\t\t\t,custom_rank\n\t\t\t\t,tags\n\t\t\t\t,right\n\t\t\t\t,site\n\t\t\t\t,param\n\t\t\t) VALUES (\n\t\t\t\t{$ID}\n\t\t\t\t,'" . $this->Escape($arFields["TITLE"]) . "'\n\t\t\t\t,'" . $this->Escape($BODY) . "'\n\t\t\t\t," . sprintf("%u", crc32($arFields["MODULE_ID"])) . "\n\t\t\t\t,'" . $this->Escape($arFields["MODULE_ID"]) . "'\n\t\t\t\t," . sprintf("%u", crc32($arFields["ITEM_ID"])) . "\n\t\t\t\t,'" . $this->Escape($arFields["ITEM_ID"]) . "'\n\t\t\t\t," . sprintf("%u", crc32($arFields["PARAM1"])) . "\n\t\t\t\t,'" . $this->Escape($arFields["PARAM1"]) . "'\n\t\t\t\t," . sprintf("%u", crc32($arFields["PARAM2"])) . "\n\t\t\t\t,'" . $this->Escape($arFields["PARAM2"]) . "'\n\t\t\t\t," . $DATE_CHANGE . "\n\t\t\t\t," . $DATE_FROM . "\n\t\t\t\t," . $DATE_TO . "\n\t\t\t\t," . intval($arFields["CUSTOM_RANK"]) . "\n\t\t\t\t,(" . $this->tags($arFields["SITE_ID"], $arFields["TAGS"]) . ")\n\t\t\t\t,(" . $this->rights($arFields["PERMISSIONS"]) . ")\n\t\t\t\t,(" . $this->sites($arFields["SITE_ID"]) . ")\n\t\t\t\t,(" . $this->params($arFields["PARAMS"]) . ")\n\t\t\t)\n\t\t";
$result = mysql_query($sql, $this->db);
if ($result) {
$this->tagsRegister($arFields["SITE_ID"], $arFields["TAGS"]);
} else {
throw new \Bitrix\Main\Db\SqlQueryException('Sphinx select error', mysql_error($this->db), $sql);
}
}