|
Revision a27cd9b462a686609eff744d1e6553da5605090b, 0.8 kB
(checked in by Depesz Lubaczewski <depesz@omniti.com>, 4 years ago)
|
prism procedures, and simple tool to split pg_dump -n prism -s output into many files
|
- Property mode set to
100644
|
| Line | |
|---|
| 1 |
CREATE OR REPLACE FUNCTION prism.saved_graphs_tsvector(in_graphid uuid) RETURNS tsvector |
|---|
| 2 |
AS $$DECLARE |
|---|
| 3 |
ref_graphid uuid; |
|---|
| 4 |
ref_graph_tags text; |
|---|
| 5 |
ref_title text; |
|---|
| 6 |
v_ts_search_all tsvector; |
|---|
| 7 |
BEGIN |
|---|
| 8 |
SELECT graphid,COALESCE(array_to_string(graph_tags, ' '), ' '),title into ref_graphid,ref_graph_tags,ref_title |
|---|
| 9 |
FROM prism.saved_graphs |
|---|
| 10 |
WHERE graphid =in_graphid; |
|---|
| 11 |
IF NOT FOUND THEN |
|---|
| 12 |
RETURN NULL; |
|---|
| 13 |
END IF; |
|---|
| 14 |
|
|---|
| 15 |
ref_title := coalesce(replace(ref_title, '.', ' '), ' '); |
|---|
| 16 |
ref_graph_tags := regexp_replace(ref_graph_tags, E'[_\`/.\\134]', ' ', 'g'); |
|---|
| 17 |
|
|---|
| 18 |
v_ts_search_all=to_tsvector(ref_title || ' ' ||ref_graph_tags); |
|---|
| 19 |
|
|---|
| 20 |
RETURN v_ts_search_all; |
|---|
| 21 |
END$$ |
|---|
| 22 |
LANGUAGE plpgsql STRICT; |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
ALTER FUNCTION prism.saved_graphs_tsvector(in_graphid uuid) OWNER TO reconnoiter; |
|---|