Skip to content

Commit

Permalink
Fix search
Browse files Browse the repository at this point in the history
Update the search SQL so that it no longer references the removed
speaker column and insead joins to talk_speaker and searches on
talk_speaker.speaker_name instead.
  • Loading branch information
akrabat committed Nov 22, 2015
1 parent fd80808 commit 0bab6db
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/system/application/models/talks_model.php
Expand Up @@ -619,11 +619,13 @@ public function search($term, $start, $end)

$this->db->select(
'talks.*, count(talk_comments.ID) as ccount,
get_talk_rating(talks.ID) as tavg, events.ID eid, events.event_name'
get_talk_rating(talks.ID) as tavg, events.ID eid, events.event_name,
talk_speaker.speaker_name'
);
$this->db->from('talks');

$this->db->join('talk_comments', 'talk_comments.talk_id=talks.ID', 'left');
$this->db->join('talk_speaker', 'talk_speaker.talk_id=talks.ID', 'left');
$this->db->join('events', 'events.ID=talks.event_id', 'left');

if ($start > 0) {
Expand All @@ -636,7 +638,7 @@ public function search($term, $start, $end)
$term = '%' . $term . '%';
$this->db->where(
sprintf(
'(talk_title LIKE %1$s OR talk_desc LIKE %1$s OR speaker LIKE %1$s)',
'(talk_title LIKE %1$s OR talk_desc LIKE %1$s OR speaker_name LIKE %1$s)',
$this->db->escape($term)
)
);
Expand Down

0 comments on commit 0bab6db

Please sign in to comment.