|
|
|
@ -15,23 +15,17 @@ CREATE TABLE IF NOT EXISTS catalog.upcoming_auctions (
|
|
|
|
|
sourcesitename VARCHAR(256) NOT NULL,
|
|
|
|
|
sourceurl VARCHAR(1024) NOT NULL,
|
|
|
|
|
country VARCHAR(64) NOT NULL,
|
|
|
|
|
province VARCHAR(128) NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS catalog.upcoming_auctions_fts (
|
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
|
auctionid INTEGER REFERENCES CATALOG.UPCOMING_AUCTIONS,
|
|
|
|
|
title VARCHAR(1024) NOT NULL,
|
|
|
|
|
sourcesitename VARCHAR(256) NOT NULL,
|
|
|
|
|
description TEXT NOT NULL,
|
|
|
|
|
province VARCHAR(128) NOT NULL,
|
|
|
|
|
ts tsvector GENERATED ALWAYS AS ((
|
|
|
|
|
setweight(to_tsvector('english', (sourcesitename)::TEXT), 'A') ||
|
|
|
|
|
setweight(to_tsvector('english', (title)::TEXT), 'A') ||
|
|
|
|
|
setweight(to_tsvector('english', (description)::TEXT), 'C')
|
|
|
|
|
setweight(to_tsvector('english', (description)::TEXT), 'B') ||
|
|
|
|
|
setweight(to_tsvector('english', (province)::TEXT), 'C') ||
|
|
|
|
|
setweight(to_tsvector('english', (country)::TEXT), 'C')
|
|
|
|
|
)) STORED
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS ts_idx ON catalog.upcoming_auctions_fts USING GIN(ts);
|
|
|
|
|
CREATE INDEX IF NOT EXISTS ts_idx ON catalog.upcoming_auctions USING GIN(ts);
|
|
|
|
|
|
|
|
|
|
-- +goose StatementBegin
|
|
|
|
|
CREATE OR REPLACE FUNCTION catalog.bh_import_auction(
|
|
|
|
@ -79,13 +73,6 @@ BEGIN
|
|
|
|
|
p_country,
|
|
|
|
|
p_province
|
|
|
|
|
) RETURNING id INTO auction_id;
|
|
|
|
|
|
|
|
|
|
INSERT INTO catalog.upcoming_auctions_fts (
|
|
|
|
|
auctionid,
|
|
|
|
|
title,
|
|
|
|
|
description,
|
|
|
|
|
sourcesitename
|
|
|
|
|
) VALUES ( auction_id, p_title, p_description, p_sourcesitename );
|
|
|
|
|
ELSE
|
|
|
|
|
-- 0 means there is a duplicate auction ID
|
|
|
|
|
auction_id = 0;
|
|
|
|
|