summaryrefslogtreecommitdiff
path: root/p2pvr/daemon/sql/SI_eventSearch.sql
diff options
context:
space:
mode:
Diffstat (limited to 'p2pvr/daemon/sql/SI_eventSearch.sql')
-rw-r--r--p2pvr/daemon/sql/SI_eventSearch.sql32
1 files changed, 32 insertions, 0 deletions
diff --git a/p2pvr/daemon/sql/SI_eventSearch.sql b/p2pvr/daemon/sql/SI_eventSearch.sql
new file mode 100644
index 0000000..5d14a98
--- /dev/null
+++ b/p2pvr/daemon/sql/SI_eventSearch.sql
@@ -0,0 +1,32 @@
+select
+ e.serviceid,
+ e.eventid,
+ e.title,
+ e.titlelang,
+ e.subtitle,
+ e.description,
+ e.descriptionlang,
+ e.videoaspect,
+ e.videoframerate,
+ e.videohd,
+ e.audiochannels,
+ e.audiolanguage,
+ e.subtitlelanguage,
+ e.category,
+ e.subcategory,
+ e.usercategory,
+ e.dvbrating,
+ e.starttime,
+ e.stoptime,
+ e.episode,
+ e.episodes,
+ e.year,
+ e.flags,
+ e.season
+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,
+ e.title, e.subtitle, e.starttime, e.serviceId, e.eventId
+