예제 #1
0
 /**
  * Search Quick2cart (Products).
  * The SQL must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav.
  *
  * @param   string  $text      Target search string.
  * @param   string  $phrase    Matching option (possible values: exact|any|all).  Default is "any".
  * @param   string  $ordering  Ordering option (possible values: newest|oldest|popular|alpha|category).  Default is "newest".
  * @param   mixed   $areas     An array if the search it to be restricted to areas or null to search all areas.
  *
  * @return  array  Search results.
  *
  * @since   1.6
  */
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $tag = JFactory::getLanguage()->getTag();
     require_once JPATH_ADMINISTRATOR . '/components/com_search/helpers/search.php';
     $searchText = $text;
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     $sContent = $this->params->get('search_products', 1);
     $limit = $this->params->def('search_limit', 50);
     $nullDate = $db->getNullDate();
     $date = JFactory::getDate();
     $now = $date->toSql();
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     switch ($phrase) {
         case 'exact':
             $text = $db->quote('%' . $db->escape($text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'a.name LIKE ' . $text;
             $wheres2[] = 'a.description LIKE ' . $text;
             $wheres2[] = 'a.metakey LIKE ' . $text;
             $wheres2[] = 'a.metadesc LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->quote('%' . $db->escape($word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'a.name LIKE ' . $word;
                 $wheres2[] = 'a.description LIKE ' . $word;
                 $wheres2[] = 'a.metakey LIKE ' . $word;
                 $wheres2[] = 'a.metadesc LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'oldest':
             $order = 'a.cdate ASC';
             break;
             /*case 'popular':
             		$order = 'a.hits DESC';
             		break;*/
         /*case 'popular':
         		$order = 'a.hits DESC';
         		break;*/
         case 'alpha':
             $order = 'a.name ASC';
             break;
         case 'category':
             $order = 'c.title ASC, a.title ASC';
             break;
         case 'newest':
         default:
             $order = 'a.cdate DESC';
             break;
     }
     $rows = array();
     $query = $db->getQuery(true);
     // Search products.
     if ($sContent && $limit > 0) {
         $query->clear();
         $query->select('a.item_id, a.name AS title, a.metadesc, a.metakey, a.cdate AS created')->select('a.description AS text')->select('c.title AS section')->from('#__kart_items AS a')->join('INNER', '#__categories AS c ON c.id=a.category')->where('(' . $where . ') AND a.state=1 AND c.published = 1')->group('a.item_id, a.name, a.metadesc, a.metakey, a.cdate, a.description, c.title, c.id')->order($order);
         $db->setQuery($query, 0, $limit);
         $list = $db->loadObjectList();
         $limit -= count($list);
         if (isset($list)) {
             $comquick2cartHelper = new comquick2cartHelper();
             $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=productpage&layout=default');
             foreach ($list as $key => $item) {
                 $link = 'index.php?option=com_quick2cart&view=productpage&layout=default&item_id=' . $item->item_id . '&Itemid=' . $itemid;
                 $list[$key]->href = JRoute::_($link, false);
             }
         }
         $rows[] = $list;
     }
     $results = array();
     if (count($rows)) {
         foreach ($rows as $row) {
             $new_row = array();
             foreach ($row as $article) {
                 $article->browsernav = '';
                 if (SearchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) {
                     $new_row[] = $article;
                 }
             }
             $results = array_merge($results, (array) $new_row);
         }
     }
     return $results;
 }
예제 #2
0
 /**
  * Search content (articles).
  * The SQL must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav.
  *
  * @param   string  $text      Target search string.
  * @param   string  $phrase    Matching option (possible values: exact|any|all).  Default is "any".
  * @param   string  $ordering  Ordering option (possible values: newest|oldest|popular|alpha|category).  Default is "newest".
  * @param   mixed   $areas     An array if the search it to be restricted to areas or null to search all areas.
  *
  * @return  array  Search results.
  *
  * @since   1.6
  */
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $tag = JFactory::getLanguage()->getTag();
     require_once JPATH_SITE . '/components/com_content/helpers/route.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_search/helpers/search.php';
     $searchText = $text;
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     $sContent = $this->params->get('search_content', 1);
     $sArchived = $this->params->get('search_archived', 1);
     $limit = $this->params->def('search_limit', 50);
     $nullDate = $db->getNullDate();
     $date = JFactory::getDate();
     $now = $date->toSql();
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     switch ($phrase) {
         case 'exact':
             $text = $db->quote('%' . $db->escape($text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'a.title LIKE ' . $text;
             $wheres2[] = 'a.introtext LIKE ' . $text;
             $wheres2[] = 'a.fulltext LIKE ' . $text;
             $wheres2[] = 'a.metakey LIKE ' . $text;
             $wheres2[] = 'a.metadesc LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->quote('%' . $db->escape($word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'LOWER(a.title) LIKE LOWER(' . $word . ')';
                 $wheres2[] = 'LOWER(a.introtext) LIKE LOWER(' . $word . ')';
                 $wheres2[] = 'LOWER(a.fulltext) LIKE LOWER(' . $word . ')';
                 $wheres2[] = 'LOWER(a.metakey) LIKE LOWER(' . $word . ')';
                 $wheres2[] = 'LOWER(a.metadesc) LIKE LOWER(' . $word . ')';
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'oldest':
             $order = 'a.created ASC';
             break;
         case 'popular':
             $order = 'a.hits DESC';
             break;
         case 'alpha':
             $order = 'a.title ASC';
             break;
         case 'category':
             $order = 'c.title ASC, a.title ASC';
             break;
         case 'newest':
         default:
             $order = 'a.created DESC';
             break;
     }
     $rows = array();
     $query = $db->getQuery(true);
     // Search articles.
     if ($sContent && $limit > 0) {
         $query->clear();
         // SQLSRV changes.
         $case_when = ' CASE WHEN ';
         $case_when .= $query->charLength('a.alias', '!=', '0');
         $case_when .= ' THEN ';
         $a_id = $query->castAsChar('a.id');
         $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
         $case_when .= ' ELSE ';
         $case_when .= $a_id . ' END as slug';
         $case_when1 = ' CASE WHEN ';
         $case_when1 .= $query->charLength('c.alias', '!=', '0');
         $case_when1 .= ' THEN ';
         $c_id = $query->castAsChar('c.id');
         $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
         $case_when1 .= ' ELSE ';
         $case_when1 .= $c_id . ' END as catslug';
         $query->select('a.title AS title, a.metadesc, a.metakey, a.created AS created, a.language, a.catid')->select($query->concatenate(array('a.introtext', 'a.fulltext')) . ' AS text')->select('c.title AS section, ' . $case_when . ',' . $case_when1 . ', ' . '\'2\' AS browsernav')->from('#__content AS a')->join('INNER', '#__categories AS c ON c.id=a.catid')->where('(' . $where . ') AND a.state=1 AND c.published = 1 AND a.access IN (' . $groups . ') ' . 'AND c.access IN (' . $groups . ') ' . 'AND (a.publish_up = ' . $db->quote($nullDate) . ' OR a.publish_up <= ' . $db->quote($now) . ') ' . 'AND (a.publish_down = ' . $db->quote($nullDate) . ' OR a.publish_down >= ' . $db->quote($now) . ')')->group('a.id, a.title, a.metadesc, a.metakey, a.created, a.introtext, a.fulltext, c.title, a.alias, c.alias, c.id')->order($order);
         // Filter by language.
         if ($app->isSite() && JLanguageMultilang::isEnabled()) {
             $query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')')->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
         }
         $db->setQuery($query, 0, $limit);
         $list = $db->loadObjectList();
         $limit -= count($list);
         if (isset($list)) {
             foreach ($list as $key => $item) {
                 $list[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language);
             }
         }
         $rows[] = $list;
     }
     // Search archived content.
     if ($sArchived && $limit > 0) {
         $query->clear();
         // SQLSRV changes.
         $case_when = ' CASE WHEN ';
         $case_when .= $query->charLength('a.alias', '!=', '0');
         $case_when .= ' THEN ';
         $a_id = $query->castAsChar('a.id');
         $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
         $case_when .= ' ELSE ';
         $case_when .= $a_id . ' END as slug';
         $case_when1 = ' CASE WHEN ';
         $case_when1 .= $query->charLength('c.alias', '!=', '0');
         $case_when1 .= ' THEN ';
         $c_id = $query->castAsChar('c.id');
         $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
         $case_when1 .= ' ELSE ';
         $case_when1 .= $c_id . ' END as catslug';
         $query->select('a.title AS title, a.metadesc, a.metakey, a.created AS created, ' . $query->concatenate(array("a.introtext", "a.fulltext")) . ' AS text,' . $case_when . ',' . $case_when1 . ', ' . 'c.title AS section, \'2\' AS browsernav');
         // .'CONCAT_WS("/", c.title) AS section, \'2\' AS browsernav' );
         $query->from('#__content AS a')->join('INNER', '#__categories AS c ON c.id=a.catid AND c.access IN (' . $groups . ')')->where('(' . $where . ') AND a.state = 2 AND c.published = 1 AND a.access IN (' . $groups . ') AND c.access IN (' . $groups . ') ' . 'AND (a.publish_up = ' . $db->quote($nullDate) . ' OR a.publish_up <= ' . $db->quote($now) . ') ' . 'AND (a.publish_down = ' . $db->quote($nullDate) . ' OR a.publish_down >= ' . $db->quote($now) . ')')->order($order);
         // Filter by language.
         if ($app->isSite() && JLanguageMultilang::isEnabled()) {
             $query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')')->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
         }
         $db->setQuery($query, 0, $limit);
         $list3 = $db->loadObjectList();
         // Find an itemid for archived to use if there isn't another one.
         $item = $app->getMenu()->getItems('link', 'index.php?option=com_content&view=archive', true);
         $itemid = isset($item->id) ? '&Itemid=' . $item->id : '';
         if (isset($list3)) {
             foreach ($list3 as $key => $item) {
                 $date = JFactory::getDate($item->created);
                 $created_month = $date->format("n");
                 $created_year = $date->format("Y");
                 $list3[$key]->href = JRoute::_('index.php?option=com_content&view=archive&year=' . $created_year . '&month=' . $created_month . $itemid);
             }
         }
         $rows[] = $list3;
     }
     $results = array();
     if (count($rows)) {
         foreach ($rows as $row) {
             $new_row = array();
             foreach ($row as $article) {
                 if (SearchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) {
                     $new_row[] = $article;
                 }
             }
             $results = array_merge($results, (array) $new_row);
         }
     }
     return $results;
 }
예제 #3
0
파일: teams.php 프로젝트: esorone/efcpw
 /**
  * Teams Search method
  * The sql must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav
  * @param string Target search string
  * @param string mathcing option, exact|any|all
  * @param string ordering option, newest|oldest|popular|alpha|category(if used)
  * @param mixed An array if the search it to be restricted to areas, null if search all
  */
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $tag = JFactory::getLanguage()->getTag();
     require_once JPATH_SITE . '/components/com_knvbapi/helpers/route.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_search/helpers/search.php';
     $search_text = $text;
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     $sTeam = 1;
     $sTeamArchived = 0;
     $limit = 50;
     $sTeam = $this->params->get('search_teams', 1);
     $sTeamArchived = $this->params->get('search_archived_teams', 0);
     $limit = $this->params->def('search_limit', 50);
     if ($this->params->get('itemid') != '') {
         $item_id_str = '&Itemid=' . (string) $this->params->get('itemid');
         $keep_item_id = true;
     } else {
         $item_id_str = '';
         $keep_item_id = false;
     }
     $null_date = $db->getNullDate();
     $date = JFactory::getDate();
     $now = $date->toSQL();
     $text = JString::trim($text);
     if ($text == '') {
         return array();
     }
     switch ($phrase) {
         case 'exact':
             $text = $db->quote('%' . $db->escape($text, true) . '%', false);
             $wheres_2 = array();
             $wheres_2[] = $db->quoteName('a.name') . ' LIKE ' . $text;
             $wheres_2[] = $db->quoteName('a.description') . ' LIKE ' . $text;
             $wheres_2[] = $db->quoteName('a.metakey') . ' LIKE ' . $text;
             $wheres_2[] = $db->quoteName('a.metadesc') . ' LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres_2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->quote('%' . $db->escape($word, true) . '%', false);
                 $wheres_2 = array();
                 $wheres_2[] = 'LOWER(' . $db->quoteName('a.name') . ') LIKE LOWER(' . $word . ')';
                 $wheres_2[] = 'LOWER(' . $db->quoteName('a.description') . ') LIKE LOWER(' . $word . ')';
                 $wheres_2[] = 'LOWER(' . $db->quoteName('a.metakey') . ') LIKE LOWER(' . $word . ')';
                 $wheres_2[] = 'LOWER(' . $db->quoteName('a.metadesc') . ') LIKE LOWER(' . $word . ')';
                 $wheres[] = implode(' OR ', $wheres_2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     $order = '';
     switch ($ordering) {
         case 'oldest':
             $order = $db->quoteName('a.created') . ' ASC';
             break;
         case 'popular':
             $order = $db->quoteName('a.hits') . ' DESC';
             break;
         case 'alpha':
             $order = $db->quoteName('a.name') . ' ASC';
             break;
         case 'newest':
             $order = $db->quoteName('a.created') . ' DESC';
             break;
         default:
             $order = $db->quoteName('a.ordering') . ' DESC';
             break;
     }
     $rows = array();
     $query = $db->getQuery(true);
     $search_section = JText::_('PLG_SEARCH_TEAMS_TEAMS');
     // search teams
     if ($sTeam and $limit > 0) {
         $query->clear();
         //sqlsrv changes
         $slug_select = ' CASE WHEN ';
         $slug_select .= $query->charLength('a.alias', '!=', '0');
         $slug_select .= ' THEN ';
         $a_id = $query->castAsChar('a.id');
         $slug_select .= $query->concatenate(array($a_id, 'a.alias'), ':');
         $slug_select .= ' ELSE ';
         $slug_select .= $a_id . ' END as slug, ';
         $query->select($db->quoteName('a.name') . ' AS title, ' . $db->quoteName('a.metadesc') . ', ' . $db->quoteName('a.metakey') . ', ' . $db->quoteName('a.created') . ' AS created, ' . $db->quoteName('a.description') . ' AS text, ' . $db->quoteName('a.language') . ' AS language, ' . $db->quote($search_section) . ' AS section, ' . $slug_select . '"2" AS browsernav');
         $query->from($db->quoteName('#__knvbapi_teams') . ' AS a');
         $query->where('(' . $where . ')' . 'AND ' . $db->quoteName('a.state') . ' = 1 ' . 'AND ' . $db->quoteName('a.access') . ' IN (' . $groups . ') ' . 'AND (' . $db->quoteName('a.publish_up') . ' = ' . $db->quote($null_date) . ' OR ' . $db->quoteName('a.publish_up') . ' <= ' . $db->quote($now) . ') ' . 'AND (' . $db->quoteName('a.publish_down') . ' = ' . $db->quote($null_date) . ' OR ' . $db->quoteName('a.publish_down') . ' >= ' . $db->quote($now) . ') ');
         // Filter by language
         if ($app->isSite() and JLanguageMultilang::isEnabled()) {
             $query->where($db->quoteName('a.language') . ' IN (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
             $query->where($db->quoteName('c.language') . ' IN (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
         }
         $query->group($db->quoteName('a.id') . ', ' . $db->quoteName('a.name'));
         $query->order($order);
         $db->setQuery($query, 0, $limit);
         $list = $db->loadObjectList();
         $limit -= count($list);
         if (isset($list)) {
             foreach ($list as $key => $item) {
                 $list[$key]->href = JRoute::_(KnvbapiHelperRoute::getTeamRoute($item->slug, $item->language, $this->layout, $keep_item_id));
                 //Add the selected item id to the link if there is one
                 $list[$key]->href .= $item_id_str;
             }
         }
         $rows[] = $list;
     }
     // search archived teams
     if ($sTeamArchived and $limit > 0) {
         $query->clear();
         //sqlsrv changes
         $slug_select = ' CASE WHEN ';
         $slug_select .= $query->charLength('a.alias', '!=', '0');
         $slug_select .= ' THEN ';
         $a_id = $query->castAsChar('a.id');
         $slug_select .= $query->concatenate(array($a_id, 'a.alias'), ':');
         $slug_select .= ' ELSE ';
         $slug_select .= $a_id . ' END AS slug, ';
         $query->select($db->quoteName('a.name') . ' AS title, ' . $db->quoteName('a.metadesc') . ', ' . $db->quoteName('a.metakey') . ', ' . $db->quoteName('a.created') . ' AS created, ' . $db->quoteName('a.description') . ' AS text, ' . $db->quoteName('a.language') . ' AS language, ' . $db->quote($search_section) . ' AS section, ' . $slug_select . '"2" AS browsernav');
         $query->from($db->quoteName('#__knvbapi_teams') . ' AS a');
         $query->where('(' . $where . ') ' . 'AND ' . $db->quoteName('a.state') . ' = 2 ' . 'AND ' . $db->quoteName('a.access') . ' IN (' . $groups . ') ' . 'AND (' . $db->quoteName('a.publish_up') . ' = ' . $db->quote($null_date) . ' OR ' . $db->quoteName('a.publish_up') . ' <= ' . $db->quote($now) . ') ' . 'AND (' . $db->quoteName('a.publish_down') . ' = ' . $db->quote($null_date) . ' OR ' . $db->quoteName('a.publish_down') . ' >= ' . $db->quote($now) . ') ');
         // Filter by language
         if ($app->isSite() and JLanguageMultilang::isEnabled()) {
             $query->where($db->quoteName('a.language') . ' IN (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
             $query->where($db->quoteName('c.language') . ' IN (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
         }
         $query->order($order);
         $db->setQuery($query, 0, $limit);
         $list3 = $db->loadObjectList();
         // find an itemid for archived to use if there isn't another one
         $item = $app->getMenu()->getItems('link', 'index.php?option=com_knvbapi&view=teamarchive', true);
         $item_id = isset($item) ? '&Itemid=' . $item->id : $item_id_str;
         if (isset($list3)) {
             foreach ($list3 as $key => $item) {
                 $date = JFactory::getDate($item->created);
                 $created_month = $date->format("n");
                 $created_year = $date->format("Y");
                 $list3[$key]->href = JRoute::_('index.php?option=com_knvbapi&view=teamarchive' . '&year=' . $created_year . '&month=' . $created_month . $item_id);
             }
         }
         $rows[] = $list3;
     }
     $results = array();
     if (count($rows)) {
         foreach ($rows as $row) {
             $new_row = array();
             foreach ($row as $team) {
                 if (SearchHelper::checkNoHTML($team, $search_text, array('title', 'description', 'metadesc', 'metakey'))) {
                     $new_row[] = $team;
                 }
             }
             $results = array_merge($results, (array) $new_row);
         }
     }
     return $results;
 }
예제 #4
0
 /**
  * K2 Search method
  * The sql must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav
  * @param string Target search string
  * @param string mathcing option, exact|any|all
  * @param string ordering option, newest|oldest|popular|alpha|category
  * @param mixed  An array if the search it to be restricted to areas, null if search all
  */
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     // If K2 items are not enabled in this search operation return now
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     // Trim text. If it is empty return now
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     // Load K2 Model class
     require_once JPATH_ADMINISTRATOR . '/components/com_k2/models/model.php';
     // Add include path
     K2Model::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_k2/models');
     // Search items
     $model = K2Model::getInstance('Items');
     $model->setState('site', true);
     $model->setState('search', $text);
     $model->setState('search.mode', $phrase);
     switch ($ordering) {
         case 'oldest':
             $model->setState('sorting', 'created');
             break;
         case 'popular':
             $model->setState('sorting', 'hits.reverse');
             break;
         case 'alpha':
             $model->setState('sorting', 'title');
             break;
         case 'category':
             $model->setState('sorting', 'category');
             break;
         case 'newest':
             $model->setState('sorting', 'created.reverse');
             break;
         default:
             $model->setState('sorting', 'id.reverse');
             break;
     }
     $limit = $this->params->def('search_limit', 50);
     $model->setState('limit', $limit);
     $rows = $model->getRows();
     $results = array();
     foreach ($rows as $item) {
         $item->browsernav = '';
         $item->section = $item->category->name;
         $item->href = $item->link;
         $item->text = $item->introtext . ' ' . $item->fulltext;
         $item->extra_fields_search = '';
         foreach ($item->extraFieldsGroups as $extraFieldGroup) {
             foreach ($extraFieldGroup->fields as $field) {
                 $item->extra_fields_search .= $field->output . ' ';
             }
         }
         $item->tags_search = '';
         foreach ($item->tags as $tag) {
             $item->tags_search .= $tag->name . ' ';
         }
         if (SearchHelper::checkNoHTML($item, $text, array('title', 'introtext', 'fulltext', 'extra_fields_search', 'tags_search'))) {
             $results[] = $item;
         }
     }
     return $results;
 }