* @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @link     http://www.mediboard.org */
CCanDo::checkRead();
$_min_date = CValue::get("_min_date", "*");
$_max_date = CValue::get("_max_date", "*");
$_date = CValue::get("_date", null);
$specific_user = CValue::get("user_id");
$start = (int) CValue::get("start", 0);
$words = " ";
// Données nécessaires pour la recherche
new CSearch();
$client_index = new CSearchLog();
$client_index->createClient();
$words = $client_index->constructWordsWithDate($_date, $_min_date, $_max_date);
$words = $client_index->constructWordsWithUser($words, CMediusers::get()->_id);
// Recherche fulltext
$time = 0;
$nbresult = 0;
$array_results = array();
try {
    $results_query = $client_index->searchQueryString('AND', $words, $start, 20, null, null);
    $results = $results_query->getResults();
    $time = $results_query->getTotalTime();
    $nbresult = $results_query->getTotalHits();
    // traitement des résultats
    foreach ($results as $result) {
        $var = $result->getHit();
        $var["_source"]["body"] = mb_convert_encoding($var["_source"]["body"], "WINDOWS-1252", "UTF-8");
        $author_ids[] = $var["_source"]["user_id"];
        $array_results[] = $var;
$specific_user = CValue::get("user_id");
$start = (int) CValue::get("start", 0);
$names_types = CValue::get("names_types", array());
$contextes = CValue::get("contextes", array());
$aggregate = CValue::get("aggregate");
if (in_array("CPrescriptionLineMedicament", $names_types)) {
    $names_types[] = "CPrescriptionLineMix";
    $names_types[] = "CPrescriptionLineElement";
}
// Données nécessaires pour la recherche
new CSearch();
$client_index = new CSearchLog();
$client_index->createClient();
$words .= $client_index->constructWordsWithDate($_date, $_min_date, $_max_date);
$words = $client_index->constructWordsWithType($words, $names_types);
$words = $client_index->constructWordsWithUser($words, $specific_user);
// Recherche fulltext
$time = 0;
$nbresult = 0;
$array_results = array();
$array_highlights = array();
$array_aggregation = array();
$objects_refs = array();
$authors = array();
$author_ids = array();
try {
    $results_query = $client_index->searchQueryString('AND', $words, $start, 30, $contextes, $aggregate);
    $results = $results_query->getResults();
    $time = $results_query->getTotalTime();
    $nbresult = $results_query->getTotalHits();
    // traitement des résultats