19 lines
590 B
SQL
19 lines
590 B
SQL
-- load.sql
|
|
|
|
delete from hugo_input;
|
|
|
|
\copy hugo_input (data) from 'public/index.ejsl'
|
|
|
|
insert into hugo_text (site, url, title, content)
|
|
select data ->> 'site', data ->> 'url', data ->> 'title', data ->> 'content'
|
|
from hugo_input;
|
|
-- TODO:
|
|
-- use cross join lateral jsonb_populate_recordset(null::hugo_text, data)
|
|
-- on conflict update ...
|
|
-- fill more columns
|
|
|
|
-- sample query:
|
|
-- select websearch_to_tsquery('german', 'prolog') as q \gset
|
|
-- select url, title,
|
|
-- ts_headline(content, :q, 'MaxFragments=3, MaxWords=6, MinWords=3')
|
|
-- from hugo_text where :q @@ content_tsv;
|