<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
//запрос id тем
function news_search_count($query_text)
{
	$search=Db::instance()->selectCol("SELECT DISTINCT(news_id) FROM ?_news WHERE `news_date`<=NOW() AND (MATCH(news_title) AGAINST(? IN BOOLEAN MODE) OR MATCH(news_text) AGAINST(? IN BOOLEAN MODE))", $query_text, $query_text);
	return $search;
}

//выборка результатов
function news_search_result($search, $start, $limit, $module)
{
	$path=getModulePath($module['module']);
	$results=Db::instance()->select("SELECT news_id, news_title, news_date FROM ?_news WHERE news_id IN (?a) ORDER BY  news_date DESC LIMIT ?d, ?d", $search, $start, $limit);
	$search_result=array();
	foreach($results as $result)
	{
			$search_result[]=array(	'name_html'=>$result['news_title']?$result['news_title']:$result['news_date'],
									'path'=>_url($result['news_id'], 'item', false, $path));
	}
	return $search_result;
}
?>