<commit_before><?php namespace App\Services;

use Illuminate\Support\Facades\Log;

class SearchService{

    // perform DB search with the request parameters
    public function searchBenefiters($request){
        $datesHelper = new DatesHelper();
        $queryString = "select b.*, gl.gender, msl.marital_status_title, el.education_title, wll.description as legal_working_status, wtll.work_title, floor(datediff(current_date, str_to_date(b.birth_date, '%Y-%m-%d'))/365) as age_in_years, count(mv.id) as incidents_counter, date(b.created_at) as created_at_date from benefiters as b left join benefiters_legal_status as bls on b.id = bls.benefiter_id left join medical_visits as mv on b.id = mv.benefiter_id left join medical_examination_results as mer on mv.id = mer.medical_visit_id left join medical_medication as mm on mv.id = mm.medical_visit_id left join genders_lookup as gl on b.gender_id = gl.id left join marital_status_lookup as msl on b.marital_status_id = msl.id left join education_lookup as el on b.education_id = el.id left join working_legally_lookup as wll on b.working_legally = wll.id left join work_title_list_lookup as wtll on b.work_title_id = wtll.id";
        $queryString2 = " group by b.id";
        $firstWhereParameter = true;
        $firstWhereParameterExternalSelect = true;
        if ($request['folder_number'] != ""){
            $queryString = $queryString . " where " . "b.folder_number like '%" . $request['folder_number'] . "%'";
            $firstWhereParameter = false;
        }
        if ($request['lastname'] != ""){
            if (!$firstWhereParameter){
                $queryString = $queryString . " and ";
            } else {
                $queryString = $queryString . " where ";
            }
            $queryString = $queryString . "b.lastname like '%" . $request['lastname'] . "%'";
            $firstWhereParameter = false;
        }
        if ($request['fname'] != ""){
            if (!$firstWhereParameter){
                $queryString = $queryString . " and ";
            } else {
                $queryString = $queryString . " where ";
            }<commit_msg>BEN-376 do not display deleted benefiters in search<commit_after><?php namespace App\Services;

use Illuminate\Support\Facades\Log;

class SearchService{

    // perform DB search with the request parameters
    public function searchBenefiters($request){
        $datesHelper = new DatesHelper();
        $queryString = "select b.*, gl.gender, msl.marital_status_title, el.education_title, wll.description as legal_working_status, wtll.work_title, floor(datediff(current_date, str_to_date(b.birth_date, '%Y-%m-%d'))/365) as age_in_years, count(mv.id) as incidents_counter, date(b.created_at) as created_at_date from benefiters as b left join benefiters_legal_status as bls on b.id = bls.benefiter_id left join medical_visits as mv on b.id = mv.benefiter_id left join medical_examination_results as mer on mv.id = mer.medical_visit_id left join medical_medication as mm on mv.id = mm.medical_visit_id left join genders_lookup as gl on b.gender_id = gl.id left join marital_status_lookup as msl on b.marital_status_id = msl.id left join education_lookup as el on b.education_id = el.id left join working_legally_lookup as wll on b.working_legally = wll.id left join work_title_list_lookup as wtll on b.work_title_id = wtll.id";
        $queryString2 = " and deleted_at is null group by b.id";
        $firstWhereParameter = true;
        $firstWhereParameterExternalSelect = true;
        if ($request['folder_number'] != ""){
            $queryString = $queryString . " where " . "b.folder_number like '%" . $request['folder_number'] . "%'";
            $firstWhereParameter = false;
        }
        if ($request['lastname'] != ""){
            if (!$firstWhereParameter){
                $queryString = $queryString . " and ";
            } else {
                $queryString = $queryString . " where ";
            }
            $queryString = $queryString . "b.lastname like '%" . $request['lastname'] . "%'";
            $firstWhereParameter = false;
        }
        if ($request['fname'] != ""){
            if (!$firstWhereParameter){
                $queryString = $queryString . " and ";
            } else {
                $queryString = $queryString . " where ";
            }
{'fraction_non_alphanumeric': 0.11034004163775156, 'fraction_numerical': 0.002544529262086514, 'mean_word_length': 2.8780269058295964, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3284627', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1264, 'n_words': 339}