summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-12-16 15:48:59 +0000
committerrandomdan <randomdan@localhost>2013-12-16 15:48:59 +0000
commit83b6dd7c3a5723e7390b6978d9fc1bb45ce81db2 (patch)
treea957ec4ab90ff0ad66130ec3864df7596ba7d325
parentRemove straggling debug (diff)
downloadp2pvr-83b6dd7c3a5723e7390b6978d9fc1bb45ce81db2.tar.bz2
p2pvr-83b6dd7c3a5723e7390b6978d9fc1bb45ce81db2.tar.xz
p2pvr-83b6dd7c3a5723e7390b6978d9fc1bb45ce81db2.zip
Fix events search index/function to accept null subtitles and/or descriptions
-rw-r--r--p2pvr/datasources/schema.sql6
1 files changed, 3 insertions, 3 deletions
diff --git a/p2pvr/datasources/schema.sql b/p2pvr/datasources/schema.sql
index 3f51014..e19c597 100644
--- a/p2pvr/datasources/schema.sql
+++ b/p2pvr/datasources/schema.sql
@@ -71,8 +71,8 @@ CREATE FUNCTION event_tsvector(e events) RETURNS tsvector
LANGUAGE sql STABLE LEAKPROOF
AS $$
select (setweight(to_tsvector('english', e.title), 'A') ||
- setweight(to_tsvector('english', e.subtitle), 'B') ||
- setweight(to_tsvector('english', e.description), 'C'));
+ setweight(to_tsvector('english', coalesce(e.subtitle, '')), 'B') ||
+ setweight(to_tsvector('english', coalesce(e.description, '')), 'C'));
$$;
@@ -470,7 +470,7 @@ ALTER TABLE ONLY transportstreams
-- Name: idx_event_search; Type: INDEX; Schema: public; Owner: gentoo; Tablespace:
--
-CREATE INDEX idx_event_search ON events USING gin ((((setweight(to_tsvector('english'::regconfig, title), 'A'::"char") || setweight(to_tsvector('english'::regconfig, subtitle), 'B'::"char")) || setweight(to_tsvector('english'::regconfig, description), 'C'::"char"))));
+CREATE INDEX idx_event_search ON events USING gin ((((setweight(to_tsvector('english'::regconfig, title), 'A'::"char") || setweight(to_tsvector('english'::regconfig, COALESCE(subtitle, ''::text)), 'B'::"char")) || setweight(to_tsvector('english'::regconfig, COALESCE(description, ''::text)), 'C'::"char"))));
--