本文整理汇总了PHP中CSearch::GetNext方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::GetNext方法的具体用法?PHP CSearch::GetNext怎么用?PHP CSearch::GetNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSearch
的用法示例。
在下文中一共展示了CSearch::GetNext方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: empty
$arFilter2["PARAM1"] = empty($arParams["FID"]) ? $arFilter2["PARAM1"] : $arParams["FID"];
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter1, $aSort, array($arFilter2));
if ($obSearch->errorno != 0) {
$arResult["ERROR_MESSAGE"] = $obSearch->error;
} else {
$obSearch->NavStart($arParams["TOPICS_PER_PAGE"], false);
$obSearch->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$arResult["NAV_RESULT"] = $obSearch;
$arResult["NAV_STRING"] = $obSearch->GetPageNavStringEx($navComponentObject, GetMessage("FL_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
$arResult["EMPTY"] = "Y";
$topics = array();
if ($res = $obSearch->GetNext()) {
$arResult["order"]["~relevance"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : ""), array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~topic"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=topic", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~date"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=date", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["relevance"] = htmlspecialcharsbx($arResult["order"]["~relevance"]);
$arResult["order"]["topic"] = htmlspecialcharsbx($arResult["order"]["~topic"]);
$arResult["order"]["date"] = htmlspecialcharsbx($arResult["order"]["~date"]);
$arResult["EMPTY"] = "N";
do {
if (intVal($res["ITEM_ID"]) > 0) {
$res["URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => $res["ITEM_ID"]));
$res["~URL"] = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => $res["ITEM_ID"]));
} else {
$res["URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => "s"));
$res["~URL"] = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => "s"));
}
示例2: PROPFIND
function PROPFIND(&$options, &$files, $arParams = array())
{
global $by, $order, $USER;
$io = self::GetIo();
if (!function_exists("__sort_array_folder_and_file")) {
function __sort_array_folder_and_file($res1, $res2)
{
global $by, $order;
InitSorting();
if (empty($by)) {
$by = "NAME";
$order = "ASC";
}
$by = strtoupper($by);
$order = strtoupper($order);
if ($res1["~TYPE"] == "FOLDER" && $res2["~TYPE"] == "FILE") {
return -1;
} elseif ($res1["~TYPE"] == "FILE" && $res2["~TYPE"] == "FOLDER") {
return 1;
} else {
$by = is_set($res1, $by) ? $by : "NAME";
$ord = $order;
if ($by == "TIMESTAMP_X") {
$ord = $order == "ASC" ? "DESC" : "ASC";
}
if ($ord == "ASC") {
return $res1[$by] < $res2[$by] ? -1 : 1;
} else {
return $res1[$by] < $res2[$by] ? 1 : -1;
}
}
}
}
$this->IsDir($options);
$files['files'] = array();
$arResult = array("NAV_RESULT" => false, "RESULT" => array());
if (empty($options["FILTER"])) {
if ($this->arParams["not_found"] === true) {
return false;
} elseif ($this->arParams["is_dir"] != true) {
//$files["files"]["E".$res["ID"]] = $this->_get_fileinfo($this->arParams["item_id"]);
$files["files"]["E"] = $this->_get_fileinfo($this->arParams["item_id"]);
} else {
$files["files"]["section"] = $this->_get_fileinfo($this->arParams["item_id"]);
if (!empty($this->arParams["item_id"]) && $this->arParams["item_id"] != "/") {
$arResult["SECTION"] = array("ID" => $this->arParams["item_id"], "NAME" => $this->arParams["item_id"]);
}
//$path = $this->_slashify($io->CombinePath($this->real_path_full, $this->arParams["item_id"]));
$path = CWebDavBase::CleanRelativePathString($this->arParams["item_id"], $this->real_path_full);
if ($path === false) {
return false;
}
$path = $this->_slashify($path);
if (!empty($options["depth"])) {
$dir = $io->GetDirectory($path);
if ($dir->IsExists()) {
$this->arParams["item_id"] = $this->_slashify(str_replace("//", "/", $this->arParams["item_id"]));
$tzOffset = CTimeZone::GetOffset();
$arChildren = $dir->GetChildren();
foreach ($arChildren as $node) {
$filename = $node->GetName();
$filePath = $io->CombinePath($this->arParams["item_id"], $filename);
$res = array("~TYPE" => "FOLDER", "TYPE" => "S", "ID" => $filePath, "NAME" => $filename, "TIMESTAMP_X" => $node->GetModificationTime() + $tzOffset, "PERMISSION" => $this->permission, "PATH" => $filePath, "REAL_PATH" => $path . $filename, "FILE_SIZE" => 0);
if ($this->MetaNames($res)) {
if (!$node->IsDirectory()) {
$ext = strtolower(strrchr($filename, '.'));
if (in_array($ext, $this->arFileForbiddenExtentions["READ"])) {
continue;
}
$res["~TYPE"] = "FILE";
$res["TYPE"] = "E";
$res["LOCK_STATUS"] = "green";
$res["EXTENTION"] = $ext;
$res["FILE_SIZE"] = $node->GetFileSize();
$res["FILE_ARRAY"] = array("TIMESTAMP_X" => $res["TIMESTAMP_X"], "MODULE_ID" => "webdav", "HEIGHT" => 0, "WIDTH" => 0, "FILE_SIZE" => $res["FILE_SIZE"], "CONTENT_TYPE" => $node->IsReadable() ? $this->_mimetype($path . $filename) : 'application/x-non-readable', "SUBDIR" => $io->CombinePath("/", $this->real_path, $this->arParams["item_id"]), "FILE_NAME" => $filename, "ORIGINAL_NAME" => $filename, "DESCRIPTION" => "");
}
$res["PROPS"] = $this->_get_props($filePath);
$res["LOCK_STATUS"] = 'green';
if (is_array($res['PROPS']['LOCK'])) {
$userLogin = $GLOBALS['USER']->GetLogin();
$now = time();
foreach ($res['PROPS']['LOCK'] as $arLock) {
if ($arLock['exclusivelock'] == 1 && $arLock['expires'] >= $now && $arLock['created'] <= $now) {
$res['LOCK_STATUS'] = $userLogin == $arLock['owner'] ? 'yellow' : 'red';
$rsUser = CUser::GetByLogin($arLock['owner']);
$arUser = $rsUser->GetNext();
$res['LOCKED_USER_NAME'] = '(' . $arUser['LOGIN'] . ')';
if (strlen($arUser['NAME']) > 0 && strlen($arUser['LAST_NAME']) > 0) {
$res['LOCKED_USER_NAME'] .= ' ' . $arUser['NAME'] . ' ' . $arUser['LAST_NAME'];
}
break;
}
}
}
$res['SHOW'] = $this->_getShowParams($res);
$arResult["RESULT"][($res["TYPE"] == "FOLDER" ? "S" : "E") . $filename] = $res;
$files['files'][] = $this->_get_fileinfo($this->arParams["item_id"] . $filename);
}
}
}
//.........这里部分代码省略.........
示例3: array
}
*/
if ($arResult["~how"] == "d") {
$aSort = array("DATE_CHANGE" => "DESC", "CUSTOM_RANK" => "DESC", "RANK" => "DESC");
} else {
$aSort = array("CUSTOM_RANK" => "DESC", "RANK" => "DESC", "DATE_CHANGE" => "DESC");
}
$arResult["SEARCH_RESULT"] = array();
if (strlen($arResult["~q"]) > 0 || strlen($arResult["~tags"]) > 0) {
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort);
$arResult["SEARCH_RESULT"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"]);
$arResult["NAV_STRING"] = $obSearch->GetPageNavString(GetMessage("LEARNING_RESULT_PAGES"), $arParams["NAV_TEMPLATE"]);
while ($arSearch = $obSearch->GetNext()) {
$arResult["SEARCH_RESULT"][] = $arSearch;
}
if (count($arResult["SEARCH_RESULT"]) > 0) {
if (strlen($arResult["~tags"]) > 0) {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("tags=" . urlencode($arResult["tags"]) . "&where=" . urlencode($arResult["where"]), array("tags", "where", "how"));
} else {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("q=" . urlencode($arResult["q"]) . "&where=" . urlencode($arResult["where"]), array("q", "where", "how"));
}
if ($arResult["~how"] != "d") {
$arResult["ORDER_LINK"] .= "&how=d";
}
} else {
$arResult["ERROR_MESSAGE"] = GetMessage("LEARNING_MAIN_SEARCH_NOTHING_FOUND");
}
} else {
示例4: array
<div class="c-separator-line"></div><?php
//sim items
$templateData['simId'] = array();
$templateData['simCount'] = 2;
if (empty($arResult['PROPERTIES']['TAGS']['VALUE'])) {
if (\Bitrix\Main\Loader::includeModule('iblock')) {
$arFilter = array('!ID' => $arResult['ID'], 'IBLOCK_ID' => $arParams['IBLOCK_ID'], 'ACTIVE' => 'Y', 'ACTIVE_DATE' => 'Y', 'SECTION_GLOBAL_ACTIVE' => 'Y', 'SECTION_ID' => $arResult['IBLOCK_SECTION_ID']);
$db = CIBlockElement::GetList(array('ACTIVE_FROM' => 'DESC', 'ID' => 'DESC'), $arFilter, false, array('nTopCount' => $templateData['simCount']), array('ID', 'IBLOCK_ID'));
while ($row = $db->Fetch()) {
$templateData['simId'][] = $row['ID'];
}
}
} elseif (\Bitrix\Main\Loader::includeModule('search')) {
$q = '';
foreach ($arResult['PROPERTIES']['TAGS']['VALUE'] as $val) {
if (!empty($q)) {
$q .= ' | ';
}
$q .= 'tag_search_' . $val;
}
$obSearch = new CSearch();
$obSearch->Search(array('QUERY' => $q, 'SITE_ID' => SITE_ID, 'MODULE_ID' => 'iblock', 'PARAM2' => $arResult['IBLOCK_ID'], '!ITEM_ID' => $arResult['ID']), array('RANK' => 'DESC'));
if ($obSearch->errorno == 0) {
while ($row = $obSearch->GetNext()) {
$templateData['simId'][] = $row['ITEM_ID'];
if (count($templateData['simId']) >= $templateData['simCount']) {
break;
}
}
}
}
示例5: array
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
$arResult["SEARCH"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
//Search restart
if (!$ar && $arParams["RESTART"] == "Y" && $obSearch->Query->bStemming) {
$exFILTER["STEMMING"] = false;
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
}
}
$arReturn = array();
while ($ar) {
$arReturn[$ar["ID"]] = $ar["ITEM_ID"];
$ar["CHAIN_PATH"] = $APPLICATION->GetNavChain($ar["URL"], 0, $folderPath . "/chain_template.php", true, false);
$ar["URL"] = htmlspecialcharsbx($ar["URL"]);
$ar["TAGS"] = array();
if (!empty($ar["~TAGS_FORMATED"])) {
foreach ($ar["~TAGS_FORMATED"] as $name => $tag) {
if ($arParams["TAGS_INHERIT"] == "Y") {
$arTags = $arResult["REQUEST"]["~TAGS_ARRAY"];
$arTags[$tag] = $tag;
$tags = implode(",", $arTags);
} else {
示例6: PROPFIND
function PROPFIND(&$options, &$files, $arParams = array())
{
global $DB;
if (empty($files)) {
$files = array();
}
$files["files"] = array();
$arParams = is_array($arParams) ? $arParams : array();
if ($this->e_rights) {
$options['check_permissions'] = false;
}
$this->IsDir($options);
$arParamsIsDir = $this->arParams;
$arResult = array("NAV_RESULT" => false, "RESULT" => array());
if ($arParamsIsDir["not_found"] === true) {
$msg = $arParamsIsDir['parent_id'] === false ? GetMessage("WD_FOLDER_NOT_FOUND") : GetMessage("WD_FILE_NOT_FOUND");
return $this->ThrowError("404 Not Found", "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND", $msg, __LINE__);
} elseif ($arParamsIsDir["is_dir"] != true) {
$db_res = $this->_get_mixed_list(intVal($arParamsIsDir["parent_id"]), $arParams, intVal($arParamsIsDir["item_id"]));
if ($db_res && ($res = $db_res->Fetch())) {
if ($this->MetaNames($res)) {
$files["files"]["F" . $res["ID"]] = $this->_get_file_info_arr($res, $arParams);
if ($arParams["return"] == "array") {
$files["files"]["F" . $res["ID"]] = $res;
}
$arResult["RESULT"]["E" . $res["ID"]] = $res;
// dummy
}
}
} else {
if (!empty($arParamsIsDir['dir_array'][self::UF_LINK_SECTION_ID])) {
$linkWebdav = new self($arParamsIsDir['dir_array'][self::UF_LINK_IBLOCK_ID], $this->base_url . $this->_path, array_merge($this->_originalParams, array('ROOT_SECTION_ID' => $arParamsIsDir['dir_array'][self::UF_LINK_SECTION_ID], 'symlinkMode' => true, 'symlinkSectionData' => $arParamsIsDir['dir_array'], 'symlinkRealRootSectionData' => $this->arRootSection)));
$options = array('path' => '/', 'depth' => 1, 'check_permissions' => false);
$params = array_merge($arParams, array('PARENT_ID' => $arParamsIsDir['dir_array'][self::UF_LINK_SECTION_ID]));
$linkWebdav->_path = $this->_path;
return $linkWebdav->PROPFIND($options, $files, $params);
}
//simple detect symlink
list($contextType, $contextEntityId) = $this->getContextData();
if ($arParamsIsDir['dir_array']) {
$sectionData = $this->getSectionDataForLinkAnalyze($arParamsIsDir['dir_array']['ID'], array('IBLOCK_ID' => $arParamsIsDir['dir_array']['IBLOCK_ID'], 'ID' => $arParamsIsDir['dir_array']['ID']));
if (!$this->_symlinkMode && CWebDavSymlinkHelper::isLink($contextType, $contextEntityId, $sectionData)) {
$symlinkSectionData = CWebDavSymlinkHelper::getLinkData($contextType, $contextEntityId, $sectionData);
}
}
if (!empty($symlinkSectionData)) {
$linkWebdav = new self($symlinkSectionData[self::UF_LINK_IBLOCK_ID], $this->base_url . $this->_path, array_merge($this->_originalParams, array('ROOT_SECTION_ID' => $symlinkSectionData[self::UF_LINK_SECTION_ID], 'symlinkMode' => true, 'symlinkSectionData' => $symlinkSectionData, 'symlinkRealRootSectionData' => $this->arRootSection)));
$options = array('path' => '/', 'depth' => 1, 'check_permissions' => false);
$params = array_merge($arParams, array('PARENT_ID' => $arParamsIsDir['dir_array']['ID']));
$linkWebdav->_path = $this->_path;
return $linkWebdav->PROPFIND($options, $files, $params);
}
if ($arParamsIsDir["item_id"] <= 0 || $this->arRootSection["ID"] == $arParamsIsDir["item_id"]) {
$files["files"]["iblock"] = $this->get_iblock_info($arr);
if ($this->_symlinkMode) {
$files["files"]["iblock"]['path'] = $this->_path;
if (SITE_CHARSET != "UTF-8") {
$files["files"]["iblock"]['path'] = $GLOBALS["APPLICATION"]->ConvertCharset($this->_path, SITE_CHARSET, "UTF-8");
}
}
$arResult["IBLOCK"] = $arr;
} else {
$arResult["SECTION"] = $this->arParams["dir_array"];
if ($this->MetaNames($arResult["SECTION"])) {
$files["files"]["section"] = $this->_get_section_info_arr($arResult["SECTION"]);
} else {
unset($arResult["SECTION"]);
}
}
if (!empty($options["depth"])) {
if (intVal($arParamsIsDir["item_id"]) <= 0) {
$arParamsIsDir["item_id"] = $this->arRootSection ? $this->arRootSection["ID"] : $arParamsIsDir["item_id"];
}
// content search
$arSearchResults = array();
if (isset($arParams["FILTER"]["content"]) && strlen($arParams["FILTER"]["content"]) > 0 && IsModuleInstalled('search') && CModule::IncludeModule('search')) {
$obSearch = new CSearch();
if (preg_match("/\\.[a-zA-Z]{3,4}\$/", $arParams["FILTER"]["content"])) {
$arParams["FILTER"]["content"] = '"' . $arParams["FILTER"]["content"] . '"';
}
$arSearchParams = array("QUERY" => $arParams["FILTER"]["content"]);
if (!$this->arRootSection) {
$arSearchParams += array("MODULE_ID" => "iblock", "PARAM_2" => $this->IBLOCK_ID);
} else {
if (isset($this->attributes['user_id'])) {
$arSearchParams += array("PARAMS" => array("socnet_user" => $this->attributes['user_id']));
} elseif (isset($this->attributes['group_id'])) {
$arSearchParams += array("PARAMS" => array("socnet_group" => $this->attributes['group_id']));
}
}
$obSearch->Search($arSearchParams);
if ($obSearch->errorno != 0) {
$arResult["ERROR_MESSAGE"] = $obSearch->error;
} else {
while ($arSearchResultItem = $obSearch->GetNext()) {
$arSearchResults[$arSearchResultItem['ITEM_ID']] = true;
}
}
}
$arSearchOptParams = array_flip(array("SHOW_NEW", "SHOW_HISTORY", "FILE_SIZE_multiply"));
//.........这里部分代码省略.........
示例7: CSearch
$obSearch = new CSearch();
$obSearch->Search($arFilter, array("CNT" => "DESC"), $exFILTER, true);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
$arResult["DATE"] = array();
$arResult["SEARCH"] = array();
if ($obSearch->errorno == 0) {
$res = $obSearch->GetNext();
if (!$res && $arParams["RESTART"] == "Y" && $obSearch->Query->bStemming) {
$exFILTER["STEMMING"] = false;
$obSearch = new CSearch();
$obSearch->Search($arFilter, array("CNT" => "DESC"), $exFILTER, true);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
if ($obSearch->errorno == 0) {
$res = $obSearch->GetNext();
}
}
if ($res) {
$arResult["CNT_MIN"] = $res["CNT"];
$arResult["CNT_MAX"] = $res["CNT"];
$res["TIME"] = MakeTimeStamp($res["FULL_DATE_CHANGE"]);
$arResult["TIME_MIN"] = $res["TIME"];
$arResult["TIME_MAX"] = $res["TIME"];
$arTags = array();
if ($arParams["TAGS_INHERIT"] != "N" && strlen($arParams["TAGS"]) > 0) {
$tmp = explode(",", $arParams["~TAGS"]);
foreach ($tmp as $tag) {
$tag = trim($tag);
if (strlen($tag) > 0) {
$arTags[$tag] = $tag;
示例8: getSearchedElement
/**
* $arParams,
* $request
*/
function getSearchedElement($arParams, $request)
{
if (!CModule::IncludeModule("search")) {
return false;
}
$arParams["SHOW_WHEN"] = $arParams["SHOW_WHEN"] == "Y";
if (!is_array($arParams["arrWHERE"])) {
$arParams["arrWHERE"] = array();
}
$arParams["PAGE_RESULT_COUNT"] = 50;
if ($arParams["DEFAULT_SORT"] !== "date") {
$arParams["DEFAULT_SORT"] = "rank";
}
if (strlen($arParams["FILTER_NAME"]) <= 0 || !preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/", $arParams["FILTER_NAME"])) {
$arFILTERCustom = array();
} else {
$arFILTERCustom = $GLOBALS[$arParams["FILTER_NAME"]];
if (!is_array($arFILTERCustom)) {
$arFILTERCustom = array();
}
}
$exFILTER = CSearchParameters::ConvertParamsToFilter($arParams, "arrFILTER");
//options
if (isset($_REQUEST["q"])) {
$q = trim($_REQUEST["q"]);
} else {
$q = false;
}
if ($q !== false) {
if ($arParams["USE_LANGUAGE_GUESS"] == "N" || isset($_REQUEST["spell"])) {
$arResult["REQUEST"]["~QUERY"] = $q;
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($q);
} else {
$arLang = CSearchLanguage::GuessLanguage($q);
if (is_array($arLang) && $arLang["from"] != $arLang["to"]) {
$arResult["REQUEST"]["~ORIGINAL_QUERY"] = $q;
$arResult["REQUEST"]["ORIGINAL_QUERY"] = htmlspecialcharsex($q);
$arResult["REQUEST"]["~QUERY"] = CSearchLanguage::ConvertKeyboardLayout($arResult["REQUEST"]["~ORIGINAL_QUERY"], $arLang["from"], $arLang["to"]);
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($arResult["REQUEST"]["~QUERY"]);
} else {
$arResult["REQUEST"]["~QUERY"] = $q;
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($q);
}
}
}
$arResult["URL"] = $APPLICATION->GetCurPage() . "?q=" . urlencode($q) . (isset($_REQUEST["spell"]) ? "&spell=1" : "") . ($tags !== false ? "&tags=" . urlencode($tags) : "");
if (isset($arResult["REQUEST"]["~ORIGINAL_QUERY"])) {
$arResult["ORIGINAL_QUERY_URL"] = $APPLICATION->GetCurPage() . "?q=" . urlencode($arResult["REQUEST"]["~ORIGINAL_QUERY"]) . "&spell=1" . "&where=" . urlencode($arResult["REQUEST"]["WHERE"]) . ($arResult["REQUEST"]["HOW"] == "d" ? "&how=d" : "") . ($arResult["REQUEST"]["FROM"] ? '&from=' . urlencode($arResult["REQUEST"]["~FROM"]) : "") . ($arResult["REQUEST"]["TO"] ? '&to=' . urlencode($arResult["REQUEST"]["~TO"]) : "") . ($tags !== false ? "&tags=" . urlencode($tags) : "");
}
$templatePage = "";
$arReturn = false;
$arFilter = array("SITE_ID" => SITE_ID, "QUERY" => $arResult["REQUEST"]["~QUERY"], "TAGS" => $arResult["REQUEST"]["~TAGS"]);
$arFilter = array_merge($arFILTERCustom, $arFilter);
if ($from) {
$arFilter[">=DATE_CHANGE"] = $from;
}
if ($to) {
$arFilter["<=DATE_CHANGE"] = $to;
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
$arResult["SEARCH"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
//Search restart
if (!$ar && $arParams["RESTART"] == "Y" && $obSearch->Query->bStemming) {
$exFILTER["STEMMING"] = false;
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
}
}
$arReturn = array();
while ($ar) {
$arReturn[$ar["ID"]] = $ar["ITEM_ID"];
$ar["CHAIN_PATH"] = $APPLICATION->GetNavChain($ar["URL"], 0, $folderPath . "/chain_template.php", true, false);
$ar["URL"] = htmlspecialcharsbx($ar["URL"]);
$ar["TAGS"] = array();
if (!empty($ar["~TAGS_FORMATED"])) {
foreach ($ar["~TAGS_FORMATED"] as $name => $tag) {
if ($arParams["TAGS_INHERIT"] == "Y") {
$arTags = $arResult["REQUEST"]["~TAGS_ARRAY"];
$arTags[$tag] = $tag;
$tags = implode(",", $arTags);
} else {
$tags = $tag;
}
//.........这里部分代码省略.........