I got it ! Here is my final code for people who will search for similar problem 🙂
in functions.php :
function se190254_custom_sql_for_search( ) {
global $wpdb;
//For security escape the search parameter
$search_string = esc_sql($_GET['s']);
//Build the SQL request with $wpdb->base_prefix for "portability"
$sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->base_prefix}posts.ID FROM {$wpdb->base_prefix}posts
LEFT JOIN {$wpdb->base_prefix}icl_translations t ON {$wpdb->base_prefix}posts.ID = t.element_id AND t.element_type LIKE 'post\_%'
LEFT JOIN {$wpdb->base_prefix}postmeta m ON m.post_id={$wpdb->base_prefix}posts.ID
LEFT JOIN {$wpdb->base_prefix}icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1
AND ( ( {$wpdb->base_prefix}posts.post_title LIKE '%".$search_string."%') OR ({$wpdb->base_prefix}posts.post_content LIKE '%".$search_string."%') OR ((m.meta_key = 'description') AND (m.meta_value LIKE '%".$search_string."%')) )
AND {$wpdb->base_prefix}posts.post_type IN ('page','transit_routes')
AND ({$wpdb->base_prefix}posts.post_status="publish")
AND (t.language_code="".ICL_LANGUAGE_CODE."" OR t.language_code IS NULL )
ORDER BY {$wpdb->base_prefix}posts.post_type DESC, {$wpdb->base_prefix}posts.post_date DESC";
//Get results of the SQL request (save in object by default, array_a or array_n is not needed here)
$query=$wpdb->get_results($sql);
//Loop trough each result and create a array with unique value and change it from array of object too simple array
foreach ($query as $post) {
$result[$post->ID] = $post->ID;
}
return $result;
}
in your template file :
$search_result = se190254_custom_sql_for_search();
if ( count($search_result) > 0 ) { ?>
<header class="page-header">
<h1 class="page-title"><?php printf(__('Search Results for: %s', 'se190254'), '<span>' . get_search_query() . '</span>'); ?></h1>
</header><!-- .page-header -->
<ul><?php
foreach( $search_result as $post ) {
$post = get_post($post->ID);
setup_postdata($post); ?>
<li><a href="https://wordpress.stackexchange.com/questions/190254/<?php the_permalink(); ?>"><?php the_title(); ?></a></li><?php
} ?>
</ul><?php
} else { ?>
<p>Sorry nothing match your search query</p><?php
} ?>
In hope that it will help someone out there !