%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php Class Search_Model extends CI_Model{ protected $table_name = 'SH_SearchResults'; protected $primary_key = 'SearchID'; protected $order_by = ''; protected $fields = 'SearchID, SearchKeyword, SearchResults, SearchCount, SearchRecentDate, SearchRelatedKeyword, SearchRelatedSuggestions'; Public function __construct() { parent::__construct(); } function get_search_result($id){ return $this->db->get_where($this->table_name, array($this->primary_key => $id))->row_array(); } function get_search_results($keyword = ''){ return $this->db->get_where($this->table_name, array('SearchPageURL' => $id))->row_array(); } function get_search_entries($fields = '', $where = array()){ if ($fields != '') { $this->db->select($fields); } else{ $this->db->select($this->fields_detail); } if (count($where)) { $this->db->where($where); } $Query = $this->db->get($this->table_name); $result = $Query->result_array(); $Query->free_result(); return $result; } function insert_search_entry($data){ $data['CreationDate'] = $data['UpdationDate'] = date('Y-m-d H:i:s'); $success = $this->db->insert($this->table_name, $data); if ($success) { return $this->db->insert_id(); } else { return FALSE; } } public function delete_search_entry($id) { $this->db->where($this->primary_key, $id); return $this->db->delete($this->table_name); } public function search($rowno,$rowperpage,$s){ // $Query = $this->db->query("Select SQL_CALC_FOUND_ROWS DoctorName AS Title, DoctorBriefProfile AS Excerpt, 'Doctors' AS ModuleName, 'meetourdoctors/' AS ModuleSlug, DoctorPageURL AS Slug from SH_DoctorProfile WHERE (DoctorName REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Center of Excellence' AS ModuleName, 'centersofexcellence/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentName REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=1 AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'speciality' AS ModuleName, 'speciality/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentName REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=3 AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Department' AS ModuleName, 'department/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentName REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=2 AND Status='A' // UNION // Select HealthConditionTitle AS Title, HealthConditionOverview AS Excerpt, 'Health Library' AS ModuleName, 'health-library/condition/' AS ModuleSlug, HealthConditionPageURL AS Slug from SH_HealthLibrary WHERE (HealthConditionTitle REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select PatientStoryTitle AS Title, PatientStoryContent AS Excerpt, 'Patient Story' AS ModuleName, 'patient-story/' AS ModuleSlug, PatientStoryPageURL AS Slug from SH_PatientStories WHERE (PatientStoryTitle REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select DoctorName AS Title, DoctorBriefProfile AS Excerpt, 'Doctors' AS ModuleName, 'meetourdoctors/' AS ModuleSlug, DoctorPageURL AS Slug from SH_DoctorProfile WHERE (DoctorPageURL REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Center of Excellence' AS ModuleName, 'centersofexcellence/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentPageURL REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=1 AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'speciality' AS ModuleName, 'speciality/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentPageURL REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=3 AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Department' AS ModuleName, 'department/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentPageURL REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=2 AND Status='A' // UNION // Select HealthConditionTitle AS Title, HealthConditionOverview AS Excerpt, 'Health Library' AS ModuleName, 'health-library/condition/' AS ModuleSlug, HealthConditionPageURL AS Slug from SH_HealthLibrary WHERE (HealthConditionPageURL REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select PatientStoryTitle AS Title, PatientStoryContent AS Excerpt, 'Patient Story' AS ModuleName, 'patient-story/' AS ModuleSlug, PatientStoryPageURL AS Slug from SH_PatientStories WHERE (PatientStoryContent REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select DoctorName AS Title, DoctorBriefProfile AS Excerpt, 'Doctors' AS ModuleName, 'meetourdoctors/' AS ModuleSlug, DoctorPageURL AS Slug from SH_DoctorProfile WHERE (DoctorBriefProfile REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Center of Excellence' AS ModuleName, 'centersofexcellence/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentOverview REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=1 AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'speciality' AS ModuleName, 'speciality/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentOverview REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=3 AND Status='A' // UNION // Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Department' AS ModuleName, 'department/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE (DepartmentOverview REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND DepartmentType=2 AND Status='A' // UNION // Select HealthConditionTitle AS Title, HealthConditionOverview AS Excerpt, 'Health Library' AS ModuleName, 'health-library/condition/' AS ModuleSlug, HealthConditionPageURL AS Slug from SH_HealthLibrary WHERE (HealthConditionOverview REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // Select PatientStoryTitle AS Title, PatientStoryContent AS Excerpt, 'Patient Story' AS ModuleName, 'patient-story' AS ModuleSlug, PatientStoryPageURL AS Slug from SH_PatientStories WHERE (PatientStoryContent REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' // UNION // (Select DoctorName AS Title, DoctorBriefProfile AS Excerpt, 'Doctors' AS ModuleName, 'meetourdoctors/' AS ModuleSlug, DoctorPageURL AS Slug from SH_DoctorProfile WHERE (DoctorQualification REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DoctorWorkExperience REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DoctorSpecialization REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DoctorClinicalInterest REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DoctorAcheivements REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DoctorMemberships REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DoctorResearchPublication REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') AND Status='A' ORDER BY DoctorPriorityOrder DESC) // UNION // (Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Center of Excellence' AS ModuleName, 'centersofexcellence/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE ((DepartmentInfrastructure REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentFacilities REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentServices REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentAchievements REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentHighlights REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]')) AND DepartmentType=1 AND Status='A' ORDER BY DepartmentPriorityOrder DESC) // UNION // (Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'speciality' AS ModuleName, 'speciality/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE ((DepartmentInfrastructure REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentFacilities REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentServices REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentAchievements REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentHighlights REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]')) AND DepartmentType=3 AND Status='A' ORDER BY DepartmentPriorityOrder DESC) // UNION // (Select DepartmentName AS Title, DepartmentOverview AS Excerpt, 'Department' AS ModuleName, 'department/' AS ModuleSlug, DepartmentPageURL AS Slug from SH_Departments WHERE ((DepartmentInfrastructure REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentFacilities REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentServices REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentAchievements REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (DepartmentHighlights REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]')) AND DepartmentType=2 AND Status='A' ORDER BY DepartmentPriorityOrder DESC) // UNION // (Select HealthConditionTitle AS Title, HealthConditionOverview AS Excerpt, 'Health Library' AS ModuleName, 'health-library/condition/' AS ModuleSlug, HealthConditionPageURL AS Slug from SH_HealthLibrary WHERE ((HealthConditionCommonName REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (HealthConditionSymptoms REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (HealthConditionSymptoms REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (HealthConditionCauses REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (HealthConditionTreatment REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]')) AND Status='A' ORDER BY HealthConditionPriorityOrder DESC) // UNION // (Select PatientStoryTitle AS Title, PatientStoryContent AS Excerpt, 'Patient Story' AS ModuleName, 'patient-story' AS ModuleSlug, PatientStoryPageURL AS Slug from SH_PatientStories WHERE ((PatientStoryCondition REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]') OR (PatientStoryTestimonial REGEXP '[[:<:]]".$s['SearchKeyword']."[[:>:]]')) AND Status='A' ORDER BY PatientStoryPriorityOrder DESC) LIMIT 20; "); // $result = $Query->result_array(); // $count = $this->db->query('SELECT FOUND_ROWS() as total_count;')->row_array(); // $search_result = array('results'=>$result,'total_count'=>$count['total_count']); // return $search_result; //new query // $Query = $this->db->query("SELECT SQL_CALC_FOUND_ROWS title , description , pageURL ,keyword from search where FIND_IN_SET('".$s."',keyword) limit ".$rowno." , ".$rowperpage); // $result = $Query->result_array(); // $count = $this->db->query('SELECT FOUND_ROWS() as total_count;')->row_array(); // $search_result = array('results'=>$result,'total_count'=>$count['total_count']); // return $search_result; // //return $result; //new query1 // $Query1 = $this->db->query("ALTER TABLE `search` ADD FULLTEXT(title,description,keyword)"); $Query = $this->db->query("SELECT SQL_CALC_FOUND_ROWS title , description , pageURL ,keyword from search where MATCH(title,description,keyword) AGAINST('".$s."') limit ".$rowno." , ".$rowperpage); $result = $Query->result_array(); $count = $this->db->query('SELECT FOUND_ROWS() as total_count;')->row_array(); $search_result = array('results'=>$result,'total_count'=>$count['total_count']); return $search_result; } function getrecordCount($s){ $Query = $this->db->query("SELECT count(*) as allcount from search where MATCH(title,description,keyword) AGAINST('".$s."') "); $result = $Query->result_array(); return $result[0]['allcount']; } // function insert(){ // $Query = $this->db->query("SELECT sd.DepartmentName ,sdp.DoctorName from SH_DoctorProfile sdp , SH_Departments sd // where sdp.DoctorDepartment = sd.DepartmentID; "); // $result = $Query->result_array(); // // print_r($result['DepartmentName']); // // $Query1 = $this->db->query("UPDATE search set keyword = concat(keyword, ', ".$result['DepartmentName']." ') where title like '%".$result['DoctorName']."%' ; "); // // $result1 = $Query1->result_array(); // // return $result[1]['DepartmentName']; // return $result; // } } ?>