summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2014-04-25 13:09:04 +0000
committerrandomdan <randomdan@localhost>2014-04-25 13:09:04 +0000
commitc5e28ee06ed73688f815f32eceaae52c8efdc56f (patch)
tree4544020544bd6d16e58eb5e3698648eede61c6a7
parentAdd methods for getting events that are part of schedules (diff)
downloadp2pvr-c5e28ee06ed73688f815f32eceaae52c8efdc56f.tar.bz2
p2pvr-c5e28ee06ed73688f815f32eceaae52c8efdc56f.tar.xz
p2pvr-c5e28ee06ed73688f815f32eceaae52c8efdc56f.zip
Fix the order by clause to group events correctly
-rw-r--r--p2pvr/daemon/si.cpp2
-rw-r--r--p2pvr/daemon/sql/SI_eventSearch.sql4
2 files changed, 4 insertions, 2 deletions
diff --git a/p2pvr/daemon/si.cpp b/p2pvr/daemon/si.cpp
index 26f7808..9bda6c4 100644
--- a/p2pvr/daemon/si.cpp
+++ b/p2pvr/daemon/si.cpp
@@ -133,7 +133,7 @@ SI::EventSearch(const IceUtil::Optional<std::string> & keywords, const IceUtil::
{
DVBSI::Events rtn;
SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn);
- cc.populate(Select(SI_eventSearch, from, to, serviceId, serviceId, keywords, keywords, keywords).second);
+ cc.populate(Select(SI_eventSearch, from, to, serviceId, serviceId, keywords, keywords, keywords, keywords).second);
return rtn;
}
diff --git a/p2pvr/daemon/sql/SI_eventSearch.sql b/p2pvr/daemon/sql/SI_eventSearch.sql
index 5d14a98..3a43b41 100644
--- a/p2pvr/daemon/sql/SI_eventSearch.sql
+++ b/p2pvr/daemon/sql/SI_eventSearch.sql
@@ -27,6 +27,8 @@ from events e
where tsrange(?, ?, '[)') && tsrange(e.starttime, e.stoptime)
and (e.serviceId = ? or ?::int is null)
and (event_tsvector(e) @@ plainto_tsquery(?) or ?::text is null)
-order by max(ts_rank(event_tsvector(e), plainto_tsquery(?::text))) over(order by title, subtitle, description) desc,
+order by
+ max(ts_rank(event_tsvector(e), plainto_tsquery(?))) over(partition by title) desc,
+ max(ts_rank(event_tsvector(e), plainto_tsquery(?))) over(partition by title, subtitle, description) desc,
e.title, e.subtitle, e.starttime, e.serviceId, e.eventId