123 $DB = CDatabase::GetModuleConnection(
'search');
124 $helper =
$DB->getConnection()->getSqlHelper();
129 'MODULE_ID' =>
'sc.MODULE_ID',
130 'ITEM_ID' =>
'sc.ITEM_ID',
131 'TITLE' =>
'sc.TITLE',
133 'PARAM1' =>
'sc.PARAM1',
134 'PARAM2' =>
'sc.PARAM2',
136 'DATE_FROM' =>
'sc.DATE_FROM',
137 'DATE_TO' =>
'sc.DATE_TO',
139 'CUSTOM_RANK' =>
'sc.CUSTOM_RANK',
140 'FULL_DATE_CHANGE' =>
$DB->DateToCharFunction(
'sc.DATE_CHANGE'),
141 'DATE_CHANGE' =>
$DB->DateToCharFunction(
'sc.DATE_CHANGE',
'SHORT'),
142 'DATE_CHANGE_X' =>
'sc.DATE_CHANGE',
145 if ($this->Query->bText)
147 $arSelect[
'SEARCHABLE_CONTENT'] =
'sct.SEARCHABLE_CONTENT';
149 $arSelect[
'USER_ID'] =
'sc.USER_ID';
152 if (mb_strpos($strSort,
'TITLE_RANK') !==
false)
157 foreach ($this->Query->m_stemmed_words as $stem)
159 if ($strSelect <>
'')
163 $strSelect .=
"case when position('" . $stem .
"' in upper(sc.TITLE)) > 0 then 1 else 0 end";
165 $arSelect[
'TITLE_RANK'] = $strSelect;
169 foreach ($this->Query->m_words as $word)
171 if ($strSelect <>
'')
175 $strSelect .=
"case when position('" .
$DB->ForSql(mb_strtoupper($word)) .
"' in upper(sc.TITLE)) > 0 then 1 else 0 end";
177 $arSelect[
'TITLE_RANK'] = $strSelect;
184 $strStemList = implode(
', ', $this->Query->m_stemmed_words_id);
187 $bWordPos = COption::GetOptionString(
'search',
'use_word_distance') ==
'Y';
189 if ($bIncSites && $bStem)
191 $arSelect[
'SITE_URL'] =
'scsite.URL';
192 $arSelect[
'SITE_ID'] =
'scsite.SITE_ID';
194 if (!preg_match(
'/(sc|sct)./',
$query))
198 if (
count($this->Query->m_stemmed_words) > 1)
200 $arSelect[$helper->quote(
'RANK')] =
'stt.' . $helper->quote(
'RANK');
204 $arSelect[$helper->quote(
'RANK')] =
'stt.TF';
208 FROM b_search_content sc
209 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
210 INNER JOIN b_search_content_site scsite ON sc.ID=scsite.SEARCH_CONTENT_ID
211 ' . (
count($this->Query->m_stemmed_words) > 1 ?
213 select search_content_id, max(st.TF) TF, ' . ($bWordPos ?
'case when STDDEV(st.PS)-' . $this->normdev(
count($this->Query->m_stemmed_words)) .
' between -0.000001 and 1 then 1/STDDEV(st.PS) else 0 end + ' :
'') .
"sum(st.TF/sf.FREQ) as " . $helper->quote(
'RANK') .
"
214 from b_search_content_stem st, b_search_content_freq sf
215 where st.language_id = '" . $this->Query->m_lang .
"'
216 and st.stem = sf.stem
217 and sf.language_id = st.language_id
218 and st.stem in (" . $strStemList .
')
219 ' . ($this->tf_hwm > 0 ?
'and st.TF >= ' . number_format($this->tf_hwm, 2,
'.',
'') :
'') .
'
220 ' . ($this->tf_hwm_site_id <>
'' ?
"and sf.SITE_ID = '" .
$DB->ForSQL($this->tf_hwm_site_id, 2) .
"'" :
'and sf.SITE_ID IS NULL') .
'
221 group by st.search_content_id
223 ) stt ON sc.id = stt.search_content_id'
224 :
'INNER JOIN b_search_content_stem stt ON sc.id = stt.search_content_id'
228 ' . (
count($this->Query->m_stemmed_words) > 1 ?
'' :
"
229 and stt.language_id = '" . $this->Query->m_lang .
"'
230 and stt.stem in (" . $strStemList .
')
231 ' . ($this->tf_hwm > 0 ?
'and stt.TF >= ' . number_format($this->tf_hwm, 2,
'.',
'') :
'') .
'') .
'
238 foreach ($arSelect as $selectAlias => $selectField)
240 $arGroupBy[] = $selectField;
243 if (
count($this->Query->m_stemmed_words) > 1)
247 $arSelect[$helper->quote(
'RANK')] =
'case when STDDEV(st.PS)-' . $this->
normdev(
count($this->Query->m_stemmed_words)) .
' between -0.000001 and 1 then 1/STDDEV(st.PS) else 0 end + sum(st.TF/sf.FREQ)';
251 $arSelect[$helper->quote(
'RANK')] =
'sum(st.TF/sf.FREQ)';
256 $arSelect[$helper->quote(
'RANK')] =
'st.TF';
260 FROM b_search_content sc
261 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
262 INNER JOIN b_search_content_site scsite ON sc.ID=scsite.SEARCH_CONTENT_ID
263 INNER JOIN b_search_content_stem st ON sc.id = st.search_content_id+0
264 ' . (
count($this->Query->m_stemmed_words) > 1 ?
265 'INNER JOIN b_search_content_freq sf ON
266 st.language_id = sf.language_id
268 ' . ($this->tf_hwm_site_id <>
'' ?
269 "and sf.SITE_ID = '" .
$DB->ForSQL($this->tf_hwm_site_id, 2) .
"'" :
270 'and sf.SITE_ID IS NULL'
276 AND st.STEM in (' . $strStemList .
')
277 ' . (
count($this->Query->m_stemmed_words) > 1 ?
'AND sf.STEM in (' . $strStemList .
')' :
'') .
"
278 AND st.language_id='" . $this->Query->m_lang .
"'
281 ' . implode(
', ', $arGroupBy) .
'
287 elseif ($bIncSites && !$bStem)
291 $arSelect[
'SITE_URL'] =
'scsite.URL';
292 $arSelect[
'SITE_ID'] =
'scsite.SITE_ID';
293 $arSelect[$helper->quote(
'RANK')] =
'1';
296 foreach ($arSelect as $selectAlias => $selectField)
298 $arGroupBy[] = $selectField;
301 if ($this->Query->bTagsSearch)
304 FROM b_search_content sc
305 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
306 INNER JOIN b_search_content_site scsite ON sc.ID=scsite.SEARCH_CONTENT_ID
307 INNER JOIN b_search_tags stags ON (sc.ID = stags.SEARCH_CONTENT_ID)
311 ' . (is_array($this->Query->m_tags_words) &&
count($this->Query->m_tags_words) > 0 ?
"AND stags.NAME in ('" . implode(
"','", $this->Query->m_tags_words) .
"')" :
'') .
'
313 ' . implode(
', ', $arGroupBy) .
'
322 ' . ($this->Query->bText ?
'
323 b_search_content_text sct
324 INNER JOIN b_search_content sc ON sc.ID = sct.SEARCH_CONTENT_ID
325 INNER JOIN b_search_content_site scsite ON sc.ID = scsite.SEARCH_CONTENT_ID
328 INNER JOIN b_search_content_site scsite ON sc.ID = scsite.SEARCH_CONTENT_ID
337 elseif (!$bIncSites && $bStem)
340 foreach ($arSelect as $selectAlias => $selectField)
342 $arGroupBy[] = $selectField;
345 if (
count($this->Query->m_stemmed_words) > 1)
349 $arSelect[$helper->quote(
'RANK')] =
'case when STDDEV(st.PS)-' . $this->
normdev(
count($this->Query->m_stemmed_words)) .
' between -0.000001 and 1 then 1/STDDEV(st.PS) else 0 end + sum(st.TF/sf.FREQ)';
353 $arSelect[$helper->quote(
'RANK')] =
'sum(st.TF/sf.FREQ)';
358 $arSelect[$helper->quote(
'RANK')] =
'st.TF';
362 FROM b_search_content sc
363 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
364 INNER JOIN b_search_content_stem st ON sc.id = st.search_content_id
365 ' . (
count($this->Query->m_stemmed_words) > 1 ?
366 'INNER JOIN b_search_content_freq sf ON
367 st.language_id = sf.language_id
369 ' . ($this->tf_hwm_site_id <>
'' ?
370 "and sf.SITE_ID = '" .
$DB->ForSQL($this->tf_hwm_site_id, 2) .
"'" :
371 'and sf.SITE_ID IS NULL'
377 AND st.STEM in (' . $strStemList .
')
378 ' . (
count($this->Query->m_stemmed_words) > 1 ?
'AND sf.STEM in (' . $strStemList .
')' :
'') .
"
379 AND st.language_id='" . $this->Query->m_lang .
"'
381 ' . (
count($this->Query->m_stemmed_words) > 1 ?
'
383 ' . implode(
', ', $arGroupBy) .
'
385 (' .
$query .
') ' :
'') .
'
391 $arSelect[$helper->quote(
'RANK')] =
'1';
394 foreach ($arSelect as $selectAlias => $selectField)
396 $arGroupBy[] = $selectField;
400 FROM b_search_content sc
401 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
402 ' . ($this->Query->bTagsSearch ?
'INNER JOIN b_search_tags stags ON (sc.ID = stags.SEARCH_CONTENT_ID)
406 ' . (is_array($this->Query->m_tags_words) &&
count($this->Query->m_tags_words) > 0 ?
"AND stags.NAME in ('" . implode(
"','", $this->Query->m_tags_words) .
"')" :
'') .
'
408 ' . implode(
', ', $arGroupBy) .
'
418 if ($this->offset ===
false)
431 ($this->flagsUseRatingSort & 0x01)
432 && COption::GetOptionString(
'search',
'use_social_rating') ==
'Y'
433 && COption::GetOptionString(
'search',
'dbnode_id') <= 0
436 $rsMinMax =
$DB->Query(
'select max(TOTAL_VALUE) RATING_MAX, min(TOTAL_VALUE) RATING_MIN from b_rating_voting');
437 $arMinMax = $rsMinMax->Fetch();
440 $RATING_MAX = doubleval($arMinMax[
'RATING_MAX']);
446 $RATING_MIN = doubleval($arMinMax[
'RATING_MIN']);
453 if ($RATING_MAX != 0 || $RATING_MIN != 0)
456 $arSelectOuterFields = [
459 foreach ($arSelectOuterFields as $outerField)
461 if (isset($arSelect[$outerField]))
463 $arSelectOuter[$outerField] = $arSelect[$outerField];
465 unset($arSelect[$outerField]);
468 $strSelectOuter =
'SELECT sc0.*' . ($arSelectOuter ?
', ' . implode(
', ', $arSelectOuter) :
'');
469 $strSelectInner =
'SELECT ' . ($bDistinct ?
'DISTINCT' :
'') .
"\n" . implode(
"\n,", $arSelect);
472 ' . $strSelectOuter .
', sc0.' . $helper->quote(
'RANK') .
' +
473 case when rv.TOTAL_VALUE > 0 then ' . ($RATING_MAX > 0 ?
'rv.TOTAL_VALUE/' . $RATING_MAX :
'0') .
' when
474 rv.TOTAL_VALUE < 0 then ' . ($RATING_MIN < 0 ?
'rv.TOTAL_VALUE/' . abs($RATING_MIN) :
'0') .
' else
477 ,' .
$DB->IsNull(
'rvv.VALUE',
'0') .
' RATING_USER_VOTE_VALUE
478 ,sc.ENTITY_TYPE_ID RATING_TYPE_ID
479 ,sc.ENTITY_ID RATING_ENTITY_ID
480 ,rv.TOTAL_VOTES RATING_TOTAL_VOTES
481 ,rv.TOTAL_POSITIVE_VOTES RATING_TOTAL_POSITIVE_VOTES
482 ,rv.TOTAL_NEGATIVE_VOTES RATING_TOTAL_NEGATIVE_VOTES
483 ,rv.TOTAL_VALUE RATING_TOTAL_VALUE
485 ' . $strSelectInner .
'
486 ' . $strSql . $strSort .
"\nLIMIT " .
$limit .
'
488 INNER JOIN b_search_content sc ON sc.ID = sc0.ID
489 LEFT JOIN b_rating_voting rv ON rv.ENTITY_TYPE_ID = sc.ENTITY_TYPE_ID AND rv.ENTITY_ID = sc.ENTITY_ID
490 LEFT JOIN b_rating_vote rvv ON rvv.ENTITY_TYPE_ID = sc.ENTITY_TYPE_ID AND rvv.ENTITY_ID = sc.ENTITY_ID AND rvv.USER_ID = ' . intval(
$USER->GetId()) .
'
491 ' . str_replace(
' ' . $helper->quote(
'RANK'),
' SRANK', $strSort);
496 foreach ($arSelect as $selectAlias => $selectField)
498 $strSelect .= ($strSelect ?
',' :
' ') . $selectField .
' as ' . $selectAlias .
"\n";
501 $strSql =
'SELECT ' . ($bDistinct ?
'DISTINCT' :
'') . $strSelect .
"\n" . $strSql . $strSort .
"\nLIMIT " .
$limit;
508 $DB = CDatabase::GetModuleConnection(
'search');
510 if ($bStem &&
count($this->Query->m_stemmed_words) > 1)
515 while (preg_match(
"/(AND\s+\([sct]+.searchable_content LIKE \'\%.+?\%\'\))/",
$query, $arMatches))
525 $strStemList = implode(
', ', $this->Query->m_stemmed_words_id);
528 if ($bIncSites && $bStem)
533 ,COUNT(DISTINCT stags.SEARCH_CONTENT_ID) as CNT
534 ,MAX(sc.DATE_CHANGE) DC_TMP
535 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)') .
' as FULL_DATE_CHANGE
536 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)',
'SHORT') .
' as DATE_CHANGE
537 ' . (
count($this->Query->m_stemmed_words) > 1 && mb_strpos(
$query,
'searchable_content') !==
false ?
',sct.SEARCHABLE_CONTENT' :
'') .
'
538 FROM b_search_tags stags
539 INNER JOIN b_search_content sc ON (stags.SEARCH_CONTENT_ID=sc.ID)
540 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
541 INNER JOIN b_search_content_site scsite ON sc.ID=scsite.SEARCH_CONTENT_ID
542 INNER JOIN b_search_content_stem st ON sc.id = st.search_content_id
543 ' . (
count($this->Query->m_stemmed_words) > 1 ?
544 'INNER JOIN b_search_content_freq sf ON
545 st.language_id = sf.language_id
547 ' . ($this->tf_hwm_site_id <>
'' ?
548 "and sf.SITE_ID = '" .
$DB->ForSQL($this->tf_hwm_site_id, 2) .
"'" :
549 'and sf.SITE_ID IS NULL'
555 AND st.STEM in (' . $strStemList .
')
556 ' . (
count($this->Query->m_stemmed_words) > 1 ?
'AND sf.STEM in (' . $strStemList .
')' :
'') .
"
557 AND st.language_id='" . $this->Query->m_lang .
"'
558 AND stags.SITE_ID = scsite.SITE_ID
562 ' . ((
count($this->Query->m_stemmed_words) > 1) ?
'
564 (' .
$query .
') ' :
'') .
'
568 elseif ($bIncSites && !$bStem)
573 if (
$strSqlWhere && preg_match(
'#\\s*EXISTS \\(SELECT \\* FROM b_search_content_param WHERE (SEARCH_CONTENT_ID = sc\\.ID AND PARAM_NAME = \'[^\']+\' AND PARAM_VALUE(\\s*= \'[^\']+\'|\\s+in \\(\'[^\']+\'\\)))\\)#',
$strSqlWhere, $match))
575 $strSqlJoin2 =
'INNER JOIN b_search_content_param scp ON scp.' . $match[1];
583 ,COUNT(DISTINCT stags2.SEARCH_CONTENT_ID) as CNT
584 ,MAX(sc.DATE_CHANGE) DC_TMP
585 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)') .
' as FULL_DATE_CHANGE
586 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)',
'SHORT') .
' as DATE_CHANGE
587 FROM b_search_tags stags2
588 INNER JOIN b_search_content sc ON (stags2.SEARCH_CONTENT_ID=sc.ID)
589 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
590 INNER JOIN b_search_content_site scsite ON (sc.ID=scsite.SEARCH_CONTENT_ID AND stags2.SITE_ID=scsite.SITE_ID)
594 AND ' . ($this->Query->bTagsSearch ? (
596 is_array($this->Query->m_tags_words) &&
count($this->Query->m_tags_words) ?
597 "stags.name in ('" . implode(
"', '", $this->Query->m_tags_words) .
"')" :
610 ,COUNT(DISTINCT stags.SEARCH_CONTENT_ID) as CNT
611 ,MAX(sc.DATE_CHANGE) DC_TMP
612 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)') .
' as FULL_DATE_CHANGE
613 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)',
'SHORT') .
' as DATE_CHANGE
614 FROM b_search_tags stags2
615 INNER JOIN b_search_tags stags ON (stags.SEARCH_CONTENT_ID=stags2.SEARCH_CONTENT_ID and stags.SITE_ID=stags2.SITE_ID)
616 INNER JOIN b_search_content sc ON (stags.SEARCH_CONTENT_ID=sc.ID)
617 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
618 INNER JOIN b_search_content_site scsite ON (sc.ID=scsite.SEARCH_CONTENT_ID AND stags.SITE_ID=scsite.SITE_ID)
622 AND ' . ($this->Query->bTagsSearch ? (
624 is_array($this->Query->m_tags_words) &&
count($this->Query->m_tags_words) ?
625 "stags.name in ('" . implode(
"', '", $this->Query->m_tags_words) .
"')" :
630 ' . ($this->Query->bTagsSearch ?
'
632 (' .
$query .
')' :
'') .
'
637 elseif (!$bIncSites && $bStem)
642 ,COUNT(DISTINCT stags.SEARCH_CONTENT_ID) as CNT
643 ,MAX(sc.DATE_CHANGE) DC_TMP
644 , ' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)') .
' as FULL_DATE_CHANGE
645 , ' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)',
'SHORT') .
' as DATE_CHANGE
646 ' . (
count($this->Query->m_stemmed_words) > 1 && mb_strpos(
$query,
'searchable_content') !==
false ?
',sct.SEARCHABLE_CONTENT' :
'') .
'
647 FROM b_search_tags stags
648 INNER JOIN b_search_content sc ON (stags.SEARCH_CONTENT_ID=sc.ID)
649 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
650 INNER JOIN b_search_content_stem st ON sc.id = st.search_content_id
651 ' . (
count($this->Query->m_stemmed_words) > 1 ?
652 'INNER JOIN b_search_content_freq sf ON
653 st.language_id = sf.language_id
655 ' . ($this->tf_hwm_site_id <>
'' ?
656 "and sf.SITE_ID = '" .
$DB->ForSQL($this->tf_hwm_site_id, 2) .
"'" :
657 'and sf.SITE_ID IS NULL'
663 AND st.STEM in (' . $strStemList .
')
664 ' . (
count($this->Query->m_stemmed_words) > 1 ?
'AND sf.STEM in (' . $strStemList .
')' :
'') .
"
665 AND st.language_id='" . $this->Query->m_lang .
"'
669 ' . (
count($this->Query->m_stemmed_words) > 1 ?
'
672 (' .
$query .
') ' :
'') .
'
681 ,COUNT(DISTINCT stags.SEARCH_CONTENT_ID) as CNT
682 ,MAX(sc.DATE_CHANGE) DC_TMP
683 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)') .
' as FULL_DATE_CHANGE
684 ,' .
$DB->DateToCharFunction(
'MAX(sc.DATE_CHANGE)',
'SHORT') .
' as DATE_CHANGE
685 FROM b_search_tags stags2
686 INNER JOIN b_search_tags stags ON (stags.SEARCH_CONTENT_ID=stags2.SEARCH_CONTENT_ID and stags.SITE_ID=stags2.SITE_ID)
687 INNER JOIN b_search_content sc ON (stags.SEARCH_CONTENT_ID=sc.ID)
688 ' . ($this->Query->bText ?
'INNER JOIN b_search_content_text sct ON sct.SEARCH_CONTENT_ID = sc.ID' :
'') .
'
691 AND ' . ($this->Query->bTagsSearch ? (
693 is_array($this->Query->m_tags_words) &&
count($this->Query->m_tags_words) ?
694 "stags.name in ('" . implode(
"', '", $this->Query->m_tags_words) .
"')" :
699 ' . ($this->Query->bTagsSearch ?
'
701 (' .
$query .
')' :
'') .
'
711 return $strSql .
'LIMIT ' .
$limit;
915 $DB = CDatabase::GetModuleConnection(
'search');
916 $helper =
$DB->getConnection()->getSqlHelper();
917 static $CACHE_SITE_LANGS = [];
921 if (!is_array($arLID))
928 if (!array_key_exists(
$site, $CACHE_SITE_LANGS))
930 $db_site_tmp = CSite::GetByID(
$site);
931 if ($ar_site_tmp = $db_site_tmp->Fetch())
933 $CACHE_SITE_LANGS[
$site] = [
934 'LANGUAGE_ID' => $ar_site_tmp[
'LANGUAGE_ID'],
935 'CHARSET' => $ar_site_tmp[
'CHARSET'],
936 'SERVER_NAME' => $ar_site_tmp[
'SERVER_NAME']
941 $CACHE_SITE_LANGS[
$site] =
false;
944 if (is_array($CACHE_SITE_LANGS[
$site]))
946 $arLang[$CACHE_SITE_LANGS[
$site][
'LANGUAGE_ID']] =
true;
950 foreach ($arLang as
$lang => $value)
955 $docLength = array_sum($arDoc);
963 $logDocLength = log($docLength < 20 ? 20 : $docLength);
967 foreach ($arDoc as $word =>
$count)
974 'SEARCH_CONTENT_ID' =>
$ID,
975 'LANGUAGE_ID' =>
$lang,
977 'TF' => number_format(log(
$count + 1) / $logDocLength, 4,
'.',
''),
978 'PS' => number_format($arPos[$word] /
$count, 4,
'.',
''),
982 if (
count($arInsert) > $maxValues)
984 $merge = $helper->prepareMergeMultiple(
'b_search_content_stem', [
'STEM',
'LANGUAGE_ID',
'TF',
'PS',
'SEARCH_CONTENT_ID'], $arInsert);
985 if ($merge && $merge[0])
987 $DB->Query($merge[0]);
995 $merge = $helper->prepareMergeMultiple(
'b_search_content_stem', [
'STEM',
'LANGUAGE_ID',
'TF',
'PS',
'SEARCH_CONTENT_ID'], $arInsert);
996 if ($merge && $merge[0])
998 $DB->Query($merge[0]);