<commit_before><?php

namespace App\Services;

class SearchService extends BaseService
{
	public function findTechnosTeamsPeopleByTerm($term)
	{

		$sql = 'SELECT t.* 
				FROM teams t 
				LEFT JOIN team_techno tt ON tt.`id_team` = t.`id`
				LEFT JOIN techno tek ON tek.`id` = tt.`id_techno` 
				WHERE t.`name` like ?
				OR
									( tek.`code` like ? OR tek.`label` like ? OR tek.`type` like ? OR tek.`description` like ?)
				
				LIMIT 5' ;
		
		$team_list_tmp = $this->db->fetchAll($sql,array('%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%')) ;
		
		$sql = 'SELECT t.*
				FROM techno t
				INNER JOIN team_techno tt ON tt.`id_team` = ? AND tt.`id_techno` = t.`id` ;
    			';
		
		$team_list = array() ;
		foreach($team_list_tmp as $k => $team)
		{
			unset($k) ;
			$team_techno_list = $this->db->fetchAll($sql,array($team['id'])) ;
			$team['technos'] = $team_techno_list ;
			$team_list[] = $team ;
		}
		

		$sql = 'SELECT t.* FROM techno t 
				WHERE 
				t.`description` like ?
				OR t.`code` like  ?
				OR t.`label` like ?
				OR t.`type` like ?
				LIMIT 5		' ;
		$techno_list = $this->db->fetchAll($sql,array('%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%')) ;
		
		$sql = 'SELECT u.* 
FROM users u 
LEFT JOIN team_techno tt ON tt.`id_team` = u.`id_team`
LEFT JOIN techno tek ON tek.`id` = tt.`id_techno` 

WHERE
				u.`description` like ?
				OR u.`firstname` like ?
				OR u.`username` like ?
				OR u.`twittername` like ?
OR				
( tek.`code` like ? OR tek.`label` like ? OR tek.`type` like ? OR tek.`description` like ?)

LIMIT 5';
		
		$person_list = $this->db->fetchAll($sql,array('%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%')) ;
		
		return array(
			'teams' 	=> $team_list,
			'technos' 	=> $techno_list,
			'people' 	=> $person_list,
		) ;
	}
}<commit_msg>amelioration recherche globale des utilisateurs<commit_after><?php

namespace App\Services;

class SearchService extends BaseService
{
	public function findTechnosTeamsPeopleByTerm($term)
	{

		$sql = 'SELECT t.* 
				FROM teams t 
				LEFT JOIN team_techno tt ON tt.`id_team` = t.`id`
				LEFT JOIN techno tek ON tek.`id` = tt.`id_techno` 
				WHERE t.`name` like ?
				OR
									( tek.`code` like ? OR tek.`label` like ? OR tek.`type` like ? OR tek.`description` like ?)
				
				LIMIT 5' ;
		
		$team_list_tmp = $this->db->fetchAll($sql,array('%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%')) ;
		
		$sql = 'SELECT t.*
				FROM techno t
				INNER JOIN team_techno tt ON tt.`id_team` = ? AND tt.`id_techno` = t.`id` ;
    			';
		
		$team_list = array() ;
		foreach($team_list_tmp as $k => $team)
		{
			unset($k) ;
			$team_techno_list = $this->db->fetchAll($sql,array($team['id'])) ;
			$team['technos'] = $team_techno_list ;
			$team_list[] = $team ;
		}
		

		$sql = 'SELECT t.* FROM techno t 
				WHERE 
				t.`description` like ?
				OR t.`code` like  ?
				OR t.`label` like ?
				OR t.`type` like ?
				LIMIT 5		' ;
		$techno_list = $this->db->fetchAll($sql,array('%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%')) ;
		
		$sql = 'SELECT distinct u.* 
				FROM users u 
				LEFT JOIN team_techno tt ON tt.`id_team` = u.`id_team`
				LEFT JOIN techno tek ON tek.`id` = tt.`id_techno` 
				
				WHERE
								
				( tek.`code` like ? OR tek.`label` like ? OR tek.`type` like ? OR tek.`description` like ?)
				
				LIMIT 5';
		
		$person_list = $this->db->fetchAll($sql,array('%'.$term.'%','%'.$term.'%','%'.$term.'%','%'.$term.'%')) ;
		
		return array(
			'teams' 	=> $team_list,
			'technos' 	=> $techno_list,
			'people' 	=> $person_list,
		) ;
	}
}
{'fraction_non_alphanumeric': 0.22216172066430712, 'fraction_numerical': 0.0016335420637081405, 'mean_word_length': 2.8471204188481676, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1766669', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1484, 'n_words': 303}